Update() public method

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void
Ejemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            _world.Update(gameTime);
            _user.Update(gameTime);
            _sideBar.Update(gameTime);
            _messageBox.Update(gameTime);
            _inventory.Update(gameTime);
            _spells.Update(gameTime);
            Camera.Update(gameTime);
            _mouse.Update();

            // touch mega hack
            TouchCollection tc = TouchPanel.GetState();

            foreach (TouchLocation tl in tc)
            {
                if (tl.State == TouchLocationState.Released)
                {
                    Debug.WriteLine("touch: " + tl.Position.ToString());
                    TouchOrMouse(tl.Position);
                    // the map just scolls offscreen for some reason
                    _world.CenterCameraOnPlayer();
                }
            }


            SetMouseVisibility(gameTime);

            if (_state == GameState.ComputerTurn)
            {
                _world.TakeTurn();
                SetTargets();
                _world.Player.TakeTurn();
                _state = GameState.PlayerTurn;
            }

            for (int i = _achievementNotifications.Count - 1; i >= 0; i--)
            {
                _achievementNotifications[i].Update(gameTime);
            }

            if (_world.Player.Health.Current <= 0)
            {
                if (GameOver != null)
                {
                    GameOver(this, null);
                }
            }
        }