protected override void Update(GameTime gameTime) { KeyMouseReader.Update(); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } GamePlayManager.MouseRect(gameTime); camera.SetPosition(playerPos, gameState); UIKeyBinds(); switch (gameState) { case GameState.Start: break; case GameState.Play: playerPos = GamePlayManager.map.player.Position; GamePlayManager.InventorySlotCheck(); GamePlayManager.Update(gameTime); break; case GameState.Inventory: GamePlayManager.ItemUse(); break; case GameState.Over: break; case GameState.Menu: if (newGame) { menuComponent.ContinueEnable(); newGame = false; } break; } base.Update(gameTime); }
protected override void LoadContent() { IsMouseVisible = true; spriteBatch = new SpriteBatch(GraphicsDevice); camera = new Camera(GraphicsDevice.Viewport); gameStats = new GameStats(); newGame = false; GamePlayManager.Initializer(); AssetManager.LoadAssets(Content); window.AllowUserResizing = false; gameState = GameState.Menu; }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Transform); switch (gameState) { case GameState.Start: menuComponent.Draw(spriteBatch); break; case GameState.Play: GamePlayManager.Draw(spriteBatch); break; case GameState.Inventory: GamePlayManager.InventoryDraw(spriteBatch); break; case GameState.Over: break; case GameState.Menu: menuComponent.Draw(spriteBatch); break; } spriteBatch.End(); spriteBatch.Begin(); gameStats.Draw(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }