Ejemplo n.º 1
0
    /// <summary>
    /// True if the current position clashes with the differet unit
    /// </summary>
    /// <returns></returns>
    public bool thereIsClash()
    {
        //gets the tile coordinates of the bottom left of the unit
        int blX = Tile.getTile(mousePosition[0]);
        int blY = Tile.getTile(mousePosition[1]);

        //checks for clashes
        for (int x = 0; x < myXfloorSize; x++)
        {
            for (int y = 0; y < myYfloorSize; y++)
            {
                //Debug.Log("check");
                if (UnitPlacement.occupied(blX + x, blY + y, myID))
                {
                    //Debug.Log("Occupied");
                    return(true);
                }
            }
        }
        return(false);
    }
Ejemplo n.º 2
0
 private bool checkFree(int x, int y)
 {
     return(TileGrid.indexInGrid(x, y) &&
            !UnitPlacement.occupied(x, y, -1));
 }