diff --git a/Assets/Scripts/UI/BoardUI.cs b/Assets/Scripts/UI/BoardUI.cs index 910c12bf..aeae4cb8 100644 --- a/Assets/Scripts/UI/BoardUI.cs +++ b/Assets/Scripts/UI/BoardUI.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using UnityEngine; namespace Chess.Game { @@ -58,8 +59,8 @@ public void DeselectSquare (Coord coord) { } public bool TryGetSquareUnderMouse (Vector2 mouseWorld, out Coord selectedCoord) { - int file = (int) (mouseWorld.x + 4); - int rank = (int) (mouseWorld.y + 4); + int file = (int)Math.Floor(mouseWorld.x + 4); + int rank = (int)Math.Floor(mouseWorld.y + 4); if (!whiteIsBottom) { file = 7 - file; rank = 7 - rank;