Example #1
0
    public bool IsValid(Mino mino, Vector2Int centerPos)
    {
        int  minoId  = mino.GetIdInt();
        int  x       = centerPos.x;
        int  y       = centerPos.y;
        Mino tmpMino = new Mino(mino.id);

        tmpMino.SetRotation(mino.GetRotationId());
        tmpMino.SetPosition(centerPos);

        List <Vector2Int> l = GetAllCoordinates(tmpMino);

        foreach (Vector2Int v in l)
        {
            int i = v.x;
            int j = v.y;
            if (i > 9 || i < 0)
            {
                return(false);
            }
            if (j < 0)
            {
                return(false);
            }
            if (array[i, j] != 0)
            {
                return(false);
            }
        }
        return(true);
    }