public void TrySelect() { if (hovoredTile != null && hovoredTile.IsPassable() && currentPlayer.ControlsTile(hovoredTile)) { if (hovoredTile.Equals(selectedTile)) { //Deselect if clicking on a selected tile selectedTile.Deselect(); selectedTile = null; hovoredTile.Highlight(highlightTile); } else { //Deselect old tile if (selectedTile != null) { selectedTile.Deselect(); selectedTile = null; } //Select new tile selectedTile = hovoredTile; selectedTile.Select(selectTile); } } }
private bool CanMove(WorldTile moveFrom, WorldTile moveTo) { return(moveFrom != null && moveFrom.army != null && moveFrom.army.CanMove() && moveTo.IsPassable() && HexUtils.AreNeighbors(moveFrom.LocalPlace, moveTo.LocalPlace)); }