public override void drawObject(SpriteBatch spriteBatch) { /* Drawing hex hover */ Hex currentHex = GetCurrentMouseHoverHex(); for (int i = 0; i < getHexes().Count; i++) { Color color = new Color(); if (getHexes()[i].q == currentHex.q && getHexes()[i].r == currentHex.r) { color = Color.Blue; } else { color = Color.White; } spriteBatch.Draw( sprite, Layout.HexToPixel(GameManager.gridLayout, getHexes()[i]), null, color, 0f, new Vector2(sprite.Width / 2f, sprite.Height / 2f), GameManager.gridLayout.size / sprite.Width * 2f, SpriteEffects.None, 0f); } /* Registering grid mouse clicks. To be moved to Controls */ if (Mouse.GetState().LeftButton == ButtonState.Pressed) { Hex clickedHex = FractionalHex.HexRound( Layout.PixelToHex( GameManager.gridLayout, new Vector2(Controls.getMousePosition().X, Controls.getMousePosition().Y) ) ); Unit currentUnit = UnitManager.GetCurrentUnit(); if (currentUnit.State == Unit.States.Moving) { MoveManager.MoveUnit(currentUnit, clickedHex); } else { UnitManager.SelectUnitByHex(clickedHex); } } /* Drawing unit move path */ // TODO: this should be moved somewhere else. if (path != null) { Color color = Color.Green; for (int i = 0; i < path.Count; i++) { if (i > UnitManager.GetCurrentUnit().CurrentMove()) { color = Color.Red; } spriteBatch.Draw( sprite, Layout.HexToPixel(GameManager.gridLayout, path[i]), null, color, 0f, new Vector2(sprite.Width / 2f, sprite.Height / 2f), GameManager.gridLayout.size / sprite.Width * 2, SpriteEffects.None, 0f); } } }