Пример #1
0
    public void StoreShapeInGrid(BrickTetris_BrickShape shape)
    {
        if (shape == null)
        {
            return;
        }

        foreach (Transform child in shape.transform)
        {
            Vector2 position = BrickTetris_Vectorf.Round(child.position);
            _grid[(int)position.x, (int)position.y] = child;
        }
    }
Пример #2
0
    public bool IsValidPosition(BrickTetris_BrickShape shape)
    {
        foreach (Transform child in shape.transform)
        {
            Vector2 position = BrickTetris_Vectorf.Round(child.position);

            if (!IsInGrid((int)position.x, (int)position.y))
            {
                return(false);
            }

            if (IsValidOccupied((int)position.x, (int)position.y, shape))
            {
                return(false);
            }
        }
        return(true);
    }