Example #1
0
    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);
            }
        }
    }
Example #2
0
 private bool CanMove(WorldTile moveFrom, WorldTile moveTo)
 {
     return(moveFrom != null && moveFrom.army != null && moveFrom.army.CanMove() && moveTo.IsPassable() && HexUtils.AreNeighbors(moveFrom.LocalPlace, moveTo.LocalPlace));
 }