protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } UserInterface.Active.Update(gameTime); KeymouseReader.Update(); switch (state) { case GameState.Game: combat = true; menu = true; foreach (Hero h in rm.heroes) { h.Update(gameTime); camera.Update(gameTime, h, true); } if (KeymouseReader.KeyPressed(Keys.H)) { im.AddItem(lel, false); rm.warrior.agility += 1; } foreach (Monster m in rm.monsters) { m.Update(gameTime); } cm.Update(gameTime); if (game) { interfaces.Game(); game = false; } break; case GameState.Combat: game = true; menu = true; com.Update(gameTime); cm.Update(gameTime); foreach (Hero h in rm.heroes) { camera.Update(gameTime, h, false); } if (combat) { interfaces.Combat(); combat = false; } interfaces.Update(gameTime); break; case GameState.Menu: game = true; combat = true; if (menu) { menu = false; } break; } base.Update(gameTime); }
protected override void Update(GameTime gameTime) { lights.Update(gameTime, rm); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } foreach (Hero h in rm.heroes) { if (h.health <= 0) { gameOver = true; } } UserInterface.Active.Update(gameTime); KeymouseReader.Update(); im.Update(gameTime); interfaces.GlobalUpdate(gameTime, im); switch (enums.gState) { case GameState.Game: if (!gameOver) { combat = true; menu = true; foreach (DynamicSpikeTrap s in rm.spikeList) { s.Update(gameTime); } foreach (Hero h in rm.heroes) { h.Update(gameTime); camera.Update(gameTime, h, true); } foreach (Monster m in rm.monsters) { m.Update(gameTime); } foreach (Tile t in rm.invisibleTiles) { t.Update(gameTime); } foreach (RestorationBlock r in rm.restoList) { r.Update(gameTime); } foreach (Lever l in rm.leverList) { l.Update(gameTime); } foreach (Chests c in rm.chestList) { c.Update(gameTime, interfaces); } cm.Update(gameTime); if (game) { interfaces.Game(im); game = false; } } interfaces.UpdateGame(gameTime, im); break; case GameState.Combat: game = true; menu = true; com.Update(gameTime); cm.Update(gameTime); foreach (Hero h in rm.heroes) { camera.Update(gameTime, h, false); } if (combat) { interfaces.Combat(); combat = false; } interfaces.Update(gameTime); break; case GameState.Menu: game = true; combat = true; if (menu) { menu = false; } break; } base.Update(gameTime); }