protected override void Initialize()
        {
            this.stateManager = new StateManager(this.Content, this.graphics);
            this.inputHandler = new InputHandler();

            base.Initialize();
        }
예제 #2
0
 public override void Update(GameTime gameTime, InputHandler inputHandler)
 {
 }
예제 #3
0
        public override void Update(GameTime gameTime, InputHandler inputHandler)
        {
            inputHandler.PlayerMovement(this.player);

            this.player.Update(gameTime);
            this.player.Collect(this.giftFactory.GeneratedGifts);

            foreach (var tile in this.levelManager.CurrentLevel.Tiles.Where(tile => tile is CollisionTile))
            {
                this.player.Collision(tile.Rectangle);
            }

            if (this.player.Health <= 0)
            {
                this.StateManager.CurrentState = new LoseState(this.Content);
            }

            if (this.player.Score >= 50 * (this.levelManager.CurrentLevelNumber + 1))
            {
                  if (this.levelManager.CurrentLevelNumber < Constants.MaxLevel)
                {
                    this.levelManager.NextLevel();
                    this.giftFactory.Clear();
                    this.giftFactory.Produce(this.levelManager.CurrentLevel.Tiles);
                    this.enemyFactory.Clear();
                    this.enemyFactory.Produce(this.levelManager.CurrentLevel.Tiles);
                    this.player.Money = 0;
                    return;
                }
                else
                {
                    this.Content.Unload();
                    this.StateManager.CurrentState = new VictoryState(this.Content);
                }
            }

            for (int i = 0; i < this.enemyFactory.GeneratedeEnemies.Count(); i++)
            {
                this.enemyFactory.GeneratedeEnemies[i].Collision(this.player);
                this.enemyFactory.GeneratedeEnemies[i].Update(gameTime);
            }
        }
예제 #4
0
 public abstract void Update(GameTime gameTime, InputHandler inputHandler);