// Update is called once per frame
    new void LateUpdate()
    {
        base.LateUpdate();


        if (_myCommandCenter == null)
        {
            return;
        }
        float _healthPercentageDec;

        _healthPercentageDec = _myCommandCenter.GetHealthPercentage();

        healthPercentage = _healthPercentageDec * 100;
        healthAsInt      = (int)healthPercentage;

        if (_lastFrameHealthPertentage != healthAsInt)
        {
            _startedTiming = false;
            _startFadeTime = 0.0f;
            myWindow.SetWindowAlpha(1.0f);
            _faded = false;
        }

        if (_lastFrameHealthPertentage == healthAsInt)
        {
            // start the fade out
            if (!_startedTiming && !_faded)
            {
                _startFadeTime  = Time.time;
                _startedTiming  = true;
                _TimeSinceStart = 0.0f;
            }

            _curTimeDelta = Time.deltaTime;

            if (_startedTiming && !_faded)
            {
                _TimeSinceStart += _curTimeDelta;
                if (_TimeSinceStart > 3)
                {
                    _startedTiming  = false;
                    _startFadeTime  = 0.0f;
                    _TimeSinceStart = 0.0f;
                    _faded          = true;
                    myWindow.SetWindowAlpha(0.0f);
                }
                else
                {
                    myWindow.SetWindowAlpha(myWindow.GetWindowAlpha() - (0.2f * _curTimeDelta));
                }
            }
        }

        if (CCLabel != null)
        {
            CCLabel.text = "" + healthAsInt + "%";
        }

        //CCHealthBeatSprite.transform.localScale = new Vector3(_healthPercentageDec * CCHealthBeatMaxWidth, CCHealthBeatSprite.transform.localScale.y, CCHealthBeatSprite.transform.localScale.z);
        CCBG.fillAmount = _healthPercentageDec;

        _lastFrameHealthPertentage = healthAsInt;


        if (!isFullyInit)          // || _enemy == null){
        {
            Init();
            return;
        }
    }
    public override void OnActivate()
    {
        //Prepare the grid.
        if (!prepredPhaseGrid)
        {
            PreparePhaseGrid();
        }

        if (presented)
        {
            //Toggle back on the game over window.
            PhasesCountWindow.ToggleWindowOn();
            BG.ToggleWindowOn();
            ActivityManager.Instance.ToggleHud(false);

            return;
        }

        //Fill up the list.
        int index = 0;

        foreach (BasePhase.PhaseData phase in GameObjectTracker.instance._PlayerData.Breathless.PhaseList)
        {
            _resultList[index].PhaseData = phase;
            index++;
        }


        GameOverWindow.SetWindowAlpha(1.0f);
        //Set the information
        GameOverWindow.ToggleWindowOn();

        //Reset the game over window animations for bring in.
        GOAlpha.Reset();
        GOAlpha.Play(true);
        GOPosition.Reset();
        GOPosition.Play(true);
        GOBringIN.Reset();
        GOBringIN.Play(true);


        //Set the timer to game over duration upon activate.
        ResetTimer(GameOverDuration);
        curState = state.GameOver;

        //Grab the games statistics. By now the game stats should be of a completed game.
        Statistics gameStats = GameObjectTracker.instance.RunStatistics;

        if (gameStats == null)
        {
            return;
        }

        //Set the score.
        ScoreLabel.text = string.Format("{0:#,#,#}", gameStats.Score);

        //Set the time.
        //TimeLabel.text = FormatSeconds(gameStats.TimeAmount);

        //Set the bonus amount
        BonusLabel.text = "N/A";

        //Set the coins collected.
        //MoneyLabel.text =  string.Format("{0:C}",gameStats.Money);
        //MoneyLabel.text =  gameStats.Money.ToString();

        //Set the PPS label
        //PPSLabel.text = gameStats.PPS.ToString() + " PPS";
        PPSText   = string.Format("{0:#,#,#} PPS", gameStats.PPS);
        ScoreText = string.Format("{0:#,#,#}", gameStats.Score);
        CoinsText = string.Format("{0:C}", gameStats.Money);

        PPSLabel.text = ScoreText;
        viewPPS       = false;

        MoneyLabel.text = CoinsText;

        //Set the animal.

        //Grab player data.
        BaseItemCard card = GameObjectTracker.instance._PlayerData.FindCardByCannonType(gameStats.CompletionCannon);

        //Check if its a valid card theng grab the icon name.
        if (card == null || gameStats.CompletionCannon == EntityFactory.CannonTypes.NULL ||
            gameStats.CompletionCannon == EntityFactory.CannonTypes.Empty)
        {
            Animal.spriteName = "phaseunknown";
            return;
        }

        Animal.spriteName = card.DisplayInfo.IconName;
    }