Exemplo n.º 1
0
        public GameStateType Update(GameTime gameTime)
        {
            InternalScore += gameTime.ElapsedGameTime.Milliseconds;

            for (var i = 0; i < _characters.Count; i++)
            {
                _characters[i].Update(gameTime);
                CheckNextCharacterAbility(_characters[i]);
            }

            var heroesAlive = 0;

            foreach (var hero in _heroCharacters)
            {
                if (hero != null && !hero.Dead)
                {
                    heroesAlive += 1;
                }
            }

            if (heroesAlive < 4)
            {
                return(GameStateType.GameOver);
            }

            var enemiesAlive = 0;

            foreach (var enemy in _enemyCharacters)
            {
                if (enemy != null && !enemy.Dead)
                {
                    enemiesAlive += 1;
                }
            }

            if (enemiesAlive == 0)
            {
                if (_encounterTransition)
                {
                    _encounterTransitionTimer -= gameTime.ElapsedGameTime.Milliseconds;

                    if (_encounterTransitionTimer <= 0)
                    {
                        if (MoveNextEncounter())
                        {
                            return(GameStateType.PlayerWon);
                        }

                        _encounterTransition = false;
                        _gameStarted         = true;
                    }
                }
                else
                {
                    for (var i = 0; i < _characters.Count; i++)
                    {
                        _characters[i]?.CancelCasting();
                    }

                    CameraWrapper.GoToNextEncounter(_encounterTransitionDuration);
                    _encounterTransitionTimer = _encounterTransitionDuration;
                    _encounterTransition      = true;
                }
            }

            _uiManager.Update(gameTime);

            CheckInput();

            return(GameStateType.None);
        }
Exemplo n.º 2
0
 public static void Update(GameTime gameTime)
 {
     CameraWrapper.Update(gameTime);
 }