DeenGames.Utils.Tower.Core.TowerScreen.GetTopZValueAndMoveFadeToTop C# (CSharp) Method

GetTopZValueAndMoveFadeToTop() public method

public GetTopZValueAndMoveFadeToTop ( ) : float
return float
        public float GetTopZValueAndMoveFadeToTop()
        {
            float max = 0;
            foreach (Sprite s in this.mSprites)
            {
                if (s.Z > max)
                {
                    max = s.Z;
                }
            }

            foreach (Text t in this.mTexts)
            {
                if (t.Z > max)
                {
                    max = t.Z;
                }
            }

            // Keep Blackout on top
            if (this._fadeOut.Z <= max)
            {
                this._fadeOut.Z = max + 1;
                max++;
            }

            return max; // next free top Z
        }