protected override void Draw(GameTime gameTime) { if (_renderRequired) { GraphicsDevice.Clear(Color.Black); _mapConsole.CellData.Clear(); _messageConsole.CellData.Clear(); _statConsole.CellData.Clear(); _inventoryConsole.CellData.Clear(); MessageLog.Draw(_messageConsole); DungeonMap.Draw(_mapConsole, _statConsole, _inventoryConsole); MapMessageLog.Draw(_mapConsole); MessageLog.Draw(_messageConsole); TargetingSystem.Draw(_mapConsole); _inventoryConsole.CellData.Print(0, 10, "________________________________________________________________________________", Color.Green); _messageConsole.CellData.Print(0, 0, "--------------------------------------------------------------------------------", Color.Green); _statConsole.CellData.Print(0, 0, "|", Color.Green); _statConsole.CellData.Print(0, 1, "|", Color.Green); _statConsole.CellData.Print(0, 2, "|", Color.Green); _statConsole.CellData.Print(0, 3, "|", Color.Green); _statConsole.CellData.Print(0, 4, "|", Color.Green); _statConsole.CellData.Print(0, 5, "|", Color.Green); _statConsole.CellData.Print(0, 6, "|", Color.Green); _statConsole.CellData.Print(0, 7, "|", Color.Green); _statConsole.CellData.Print(0, 8, "|", Color.Green); _statConsole.CellData.Print(0, 9, "|", Color.Green); _statConsole.CellData.Print(0, 10, "|", Color.Green); _statConsole.CellData.Print(0, 11, "|", Color.Green); _statConsole.CellData.Print(0, 12, "|", Color.Green); _statConsole.CellData.Print(0, 13, "|", Color.Green); _statConsole.CellData.Print(0, 14, "|", Color.Green); _statConsole.CellData.Print(0, 15, "|", Color.Green); _statConsole.CellData.Print(0, 16, "|", Color.Green); _statConsole.CellData.Print(0, 17, "|", Color.Green); _statConsole.CellData.Print(0, 18, "|", Color.Green); _statConsole.CellData.Print(0, 19, "|", Color.Green); _statConsole.CellData.Print(0, 20, "|", Color.Green); _statConsole.CellData.Print(0, 21, "|", Color.Green); _statConsole.CellData.Print(0, 22, "|", Color.Green); _statConsole.CellData.Print(0, 23, "|", Color.Green); _statConsole.CellData.Print(0, 24, "|", Color.Green); _statConsole.CellData.Print(0, 25, "|", Color.Green); _statConsole.CellData.Print(0, 26, "|", Color.Green); _statConsole.CellData.Print(0, 27, "|", Color.Green); _statConsole.CellData.Print(0, 28, "|", Color.Green); _statConsole.CellData.Print(0, 29, "|", Color.Green); _statConsole.CellData.Print(0, 30, "|", Color.Green); _statConsole.CellData.Print(0, 31, "|", Color.Green); _statConsole.CellData.Print(0, 32, "|", Color.Green); _statConsole.CellData.Print(0, 33, "|", Color.Green); _statConsole.CellData.Print(0, 34, "|", Color.Green); _statConsole.CellData.Print(0, 35, "|", Color.Green); _statConsole.CellData.Print(0, 36, "|", Color.Green); _statConsole.CellData.Print(0, 37, "|", Color.Green); _statConsole.CellData.Print(0, 38, "|", Color.Green); _statConsole.CellData.Print(0, 39, "|", Color.Green); _statConsole.CellData.Print(0, 40, "|", Color.Green); _statConsole.CellData.Print(0, 41, "|", Color.Green); _statConsole.CellData.Print(0, 42, "|", Color.Green); _statConsole.CellData.Print(0, 43, "|", Color.Green); _statConsole.CellData.Print(0, 44, "|", Color.Green); _statConsole.CellData.Print(0, 45, "|", Color.Green); _statConsole.CellData.Print(0, 46, "|", Color.Green); _statConsole.CellData.Print(0, 47, "|", Color.Green); _statConsole.CellData.Print(0, 48, "|", Color.Green); _statConsole.CellData.Print(0, 49, "|", Color.Green); _statConsole.CellData.Print(0, 50, "|", Color.Green); _statConsole.CellData.Print(0, 51, "|", Color.Green); _statConsole.CellData.Print(0, 52, "|", Color.Green); _statConsole.CellData.Print(0, 53, "|", Color.Green); _statConsole.CellData.Print(0, 54, "|", Color.Green); _statConsole.CellData.Print(0, 55, "|", Color.Green); _statConsole.CellData.Print(0, 56, "|", Color.Green); _statConsole.CellData.Print(0, 57, "|", Color.Green); _statConsole.CellData.Print(0, 58, "|", Color.Green); _statConsole.CellData.Print(0, 59, "|", Color.Green); _statConsole.CellData.Print(0, 1, "|", Color.Green); if (RogueGame._mapLevel == 1) { _statConsole.CellData.Print(1, 60, "Location:", Color.Green); _statConsole.CellData.Print(1, 62, "Desert Pass", Color.Tan); } else if (RogueGame._mapLevel == 2) { _statConsole.CellData.Print(1, 60, "Location:", Color.Green); _statConsole.CellData.Print(1, 62, "Cavern Base Level 1", Color.Red); } else if (RogueGame._mapLevel == 3) { _statConsole.CellData.Print(1, 60, "Location:", Color.Green); _statConsole.CellData.Print(1, 62, "Cavern Base Level 2", Color.Red); } else if (RogueGame._mapLevel == 4) { _statConsole.CellData.Print(1, 60, "Location:", Color.Green); _statConsole.CellData.Print(1, 62, "Cavern Base Level 3", Color.Red); } else if (RogueGame._mapLevel == 5) { _statConsole.CellData.Print(1, 60, "Location:", Color.Green); _statConsole.CellData.Print(1, 62, "Summoning Chambers", Color.Red); } base.Draw(gameTime); } }
protected override void Update(GameTime gameTime) { bool didPlayerAct = false; _inputState.Update(gameTime); if (TargetingSystem.IsPlayerTargeting) { _renderRequired = true; TargetingSystem.HandleInput(_inputState); } else if (CommandSystem.IsPlayerTurn) { if (_inputState.IsKeyPressed(Keys.Up)) { MapMessageLog.Add(""); didPlayerAct = CommandSystem.MovePlayer(Direction.Up); } else if (_inputState.IsKeyPressed(Keys.Down)) { MapMessageLog.Add(""); didPlayerAct = CommandSystem.MovePlayer(Direction.Down); } else if (_inputState.IsKeyPressed(Keys.Left)) { didPlayerAct = CommandSystem.MovePlayer(Direction.Left); } else if (_inputState.IsKeyPressed(Keys.Right)) { didPlayerAct = CommandSystem.MovePlayer(Direction.Right); } else if (_inputState.IsKeyPressed(Keys.Escape)) { this.Exit(); } else if (_inputState.IsKeyPressed(Keys.OemPeriod)) { if (DungeonMap.CanMoveDownToNextLevel()) { MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight, 20, 13, 7, ++_mapLevel); DungeonMap = mapGenerator.CreateMap(); MessageLog = new MessageLog(); CommandSystem = new CommandSystem(); this.Window.Title = $"Sean's RogueLike Engine 3 - Level {_mapLevel}"; didPlayerAct = true; } } else { didPlayerAct = CommandSystem.HandleInput(_inputState); } if (didPlayerAct) { _renderRequired = true; CommandSystem.EndPlayerTurn(); } } else { CommandSystem.ActivateMonsters(); _renderRequired = true; } base.Update(gameTime); }