Beispiel #1
0
    private bool isValidGridPosition()
    {
        foreach (Transform child in transform)
        {
            Vector2 childPosition = Playfield.RoundPosition(child.position);

            // Not inside border?
            if (!Playfield.IsInsideBorders(childPosition))
            {
                return(false);
            }

            // Checks parent
            Transform cell = Playfield.Grid[(int)childPosition.x, (int)childPosition.y];
            if (cell != null && cell.parent != this.transform)
            {
                return(false);
            }
        }

        return(true);
    }