Okay so I have this bug that I really don't get the logic off. It's either something ultra stupid, or something stack related I don't yet understand...
Here is my code:
public void LevelLoad(Level lev)
{
#if UNITY_ANDROID && !UNITY_EDITOR
AudioManager.Instance.ReleasePool();
#endif
currentlyDisappearedFigures = 0;
if (!lev.Equals(currentLevel))
{
currentLevel = lev;
currentLevel.transparentQTY = 0; currentLevel.normalQTY = 0; currentLevel.totalQTY = 0;
currentLevel.hasDeath = false; currentLevel.hasND = false; currentLevel.hasNormal = false; currentLevel.hasTransparent = false;
foreach (Figure fig in currentLevel.Figures)
{
if (fig._figureType != null)
{
if (fig._gameObject.CompareTag("Hard"))
fig._figureType.ResetHard();
fig._figureType.RefreshFigure(currentLevel);
currentLevel.totalQTY++;
}
}
#if UNITY_ANDROID && !UNITY_EDITOR
if (lev.totalQTY > 22)
lev.totalQTY = 22;
AudioManager.Instance.CreatePool(currentLevel.totalQTY);
Debug.Log("currentLevel.totalQTY-"+currentLevel.totalQTY);
AudioManager.Instance.LoadAudio(currentLevel.hasNormal, currentLevel.normalQTY,
currentLevel.hasTransparent, currentLevel.transparentQTY,
currentLevel.hasND, currentLevel.hasDeath);
Debug.Log("HasNormal-" + currentLevel.hasNormal + ",normalQTY-" + currentLevel.normalQTY + ",hasTransparent-" +
currentLevel.hasTransparent + ",transparentlQTY-" + currentLevel.transparentQTY + ",hasND-" +
currentLevel.hasND + ",hasDeath-" + currentLevel.hasDeath);
#endif
See the:
Debug.Log("HasNormal-" + currentLevel.hasNormal + ",normalQTY-" + currentLevel.normalQTY + ",hasTransparent-" +
currentLevel.hasTransparent + ",transparentlQTY-" + currentLevel.transparentQTY + ",hasND-" +
currentLevel.hasND + ",hasDeath-" + currentLevel.hasDeath);
All of those print either FALSE, or ZERO, and I don't know why.
The thing is, I am instantiating them in:
fig._figureType.RefreshFigure(currentLevel);
Here is the inside of FigureType.RefreshFigure(). It's irrelevant, but the Debug.Log inside it shows different from the one I mentioned above:
public void RefreshFigure(Level lev)
{
gameObject.SetActive(true);
_collider.enabled = true;
if(_type != FigType.Death && _type != FigType.Transparent)
_collider.isTrigger = false;
ResetTransform();
if (_type == FigType.Normal)
{
lev.hasNormal = true;
lev.normalQTY++;
Debug.Log("Current Level has Normal: " + lev.hasNormal);
Debug.Log("Current Level Normal QTY issssss: " + lev.normalQTY);
}
Those 2 Debug.logs, inside RefreshFigure() show True, and 1.
I don't get where and why the Bool becomes false, and the Integer becomes zero?