Example #1
0
    public bool canMoveHorizontal(Block.rotation rot, int direction)
    {
        switch (rot)
        {
        case Block.rotation.DOWN:
            if (direction == -1)
            {
                return(checkDetectorArray(left));
            }
            else
            {
                return(checkDetectorArray(right));
            }

        case Block.rotation.RIGHT:
            if (direction == -1)
            {
                return(checkDetectorArray(up));
            }
            else
            {
                return(checkDetectorArray(down));
            }

        case Block.rotation.UP:
            if (direction == -1)
            {
                return(checkDetectorArray(right));
            }
            else
            {
                return(checkDetectorArray(left));
            }

        case Block.rotation.LEFT:
            if (direction == -1)
            {
                return(checkDetectorArray(down));
            }
            else
            {
                return(checkDetectorArray(up));
            }
        }
        return(false);
    }
Example #2
0
    public bool canMoveVertical(Block.rotation rot, int direction = 1)
    {
        switch (rot)
        {
        case Block.rotation.DOWN:
            if (direction == 1)
            {
                return(checkDetectorArray(down, true));
            }
            else
            {
                return(checkDetectorArray(up, true));
            }

        case Block.rotation.RIGHT:
            if (direction == 1)
            {
                return(checkDetectorArray(left, true));
            }
            else
            {
                return(checkDetectorArray(right, true));
            }

        case Block.rotation.UP:
            if (direction == 1)
            {
                return(checkDetectorArray(up, true));
            }
            else
            {
                return(checkDetectorArray(down, true));
            }

        case Block.rotation.LEFT:
            if (direction == 1)
            {
                return(checkDetectorArray(right, true));
            }
            else
            {
                return(checkDetectorArray(left, true));
            }
        }
        return(false);
    }