protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } middlePx.Update(gameTime, GraphicsDevice.Viewport); torch.Update(gameTime, GraphicsDevice.Viewport); base.Update(gameTime); }
public override void Update(GameTime gameTime) { foreach (HealthPotion HP in HealthPotion.hpList) { HP.Update(gameTime, player, boxCollider); } player.Update(gameTime, boxCollider); camera.LookAt(player.Position);//update camera healthBar.Update(gameTime, camera.Position, player); healthBarBoss.Update(gameTime, camera.Position, boss); foreach (Background b in backgrounds) { b.Update(gameTime, camera); //update map } torch1.Update(gameTime, player); torch2.Update(gameTime, player); foreach (Phantom phantom in phantomList) { if (phantom.IsAlive) { phantom.Update(gameTime, player, Content); } } if (Phantom.CountPhantomExist < 2) { phantomList.Add(new Phantom(Content)); } if (boss.IsAlive) { boss.Update(gameTime, player, Content); } if (!player.IsActive) //màn hình thua xuất hiện { ScreenState = State.Lose; } else if (!boss.IsAlive) ///màn hình win xuất hiện { ScreenState = State.Win; } }