/// <summary> /// Checks if a unit type can be placed in a location on a board /// </summary> /// <param name="unit">The unit type to check</param> /// <param name="board">The board to check</param> /// <param name="x">The x position to check, in tiles</param> /// <param name="y">The y position to check, in tiles</param> /// <returns>True if the unit type can be placed on the location on the board</returns> public static bool CanPlaceOn(this UnitType unit, Tile[,] board, int x, int y) { Tile t = board[x, y]; if (!unit.CanBeOn(t.type)) { return(false); } if ((unit.IsBuilding() && t.buildingOn != null) || (unit.IsHuman() && t.unitOn != null)) { return(false); } return(true); }