示例#1
0
    void TickGameplay()
    {
        Waves.CurrentWave.Advance(GameTime);
        Coin           += Waves.CurrentWave.ReportCoinEarned();
        LivesRemaining -= Waves.CurrentWave.ReportLivesLost();

        Projectiles.AdvanceAll(GameTime);

        Turrets.Fire(GameTime);

        if (Waves.IsComplete)
        {
            OnLevelComplete();
        }
        else if (Waves.CurrentWave.IsCompleted)
        {
            Utilities.Log("State ==> WaveCountdown");
            ShowCountdownUI();
            Waves.AdvanceToNextWave(GameTime);
            State = LevelState.WaveCountdown;
            CountdownStartTime = GameTime;
        }

        if (null != Pointer.Hitting)
        {
            GameObject go = Pointer.Hitting;
            if (go.name.StartsWith("TurretSpace"))
            {
                TurretInstance turret = Turrets.GetTurretAtPosition(GameObjectFactory.WorldVec3ToMapPos(go.transform.position));

                if (null != turret)
                {
                    go = turret.go;
                }
            }

            GameplayUI.CursorOver(go);
        }

        bool value = false;

        if (Pointer.State.ButtonDown.TryGetValue(InputState.InputIntent.Selection, out value) && value)
        {
            GameplayUI.TriggerSelectAction();
        }
        if (Pointer.State.ButtonDown.TryGetValue(InputState.InputIntent.MissileTrigger, out value) && value)
        {
            ProcessMissileTrigger();
        }


        UpdateHUD();
    }