Ejemplo n.º 1
0
    bool isValidGridPos()
    {
        foreach (Transform child in transform)
        {
            Vector2 v = PlayGrid.roundVec2(child.position);

            // Not inside Border?
            if (!PlayGrid.insideBorder(v))
            {
                return(false);
            }

            // Block in grid cell (and not part of same group)?
            if (PlayGrid.grid[(int)v.x, (int)v.y] != null &&
                PlayGrid.grid[(int)v.x, (int)v.y].parent != transform)
            {
                return(false);
            }
        }
        return(true);
    }