public override void HandleInput(InputHelper helper, KeyManager manager) { if (new Rectangle(MaxOfEmpires.overlayPos.ToPoint(), MaxOfEmpires.ScreenSize).Contains(helper.GetMousePosition(false))) { // Update the overlay overlay.update(helper); } else { // Handle input for the grid (things like moving and attacking units) battleGrid.HandleInput(helper, manager); } if (manager.KeyPressed("nextTurn", helper)) { shouldTurnUpdate = true; } // Get the selected Unit Soldier u = (Soldier)battleGrid.SelectedTile?.Unit; // Print the selected Unit's information, if it exists if (u != null) { overlay.PrintSoldierInfo(u); } // if there is no selected Unit... else { // ... get the tile the mouse is over, and show the Unit's information, if this Unit exists. Tile t = battleGrid.GetTileUnderMouse(helper); if (t != null) { overlay.PrintSoldierInfo((Soldier)t.Unit); } } }