Ejemplo n.º 1
0
    public bool MoveDown(Field field, out SearchNode sn)
    {
        Vector2Int newPos = mino.position;
        Mino       tmp    = mino.Clone();
        bool       ok     = false;

        newPos.y--;
        if (field.IsValid(mino, newPos))
        {
            tmp.Fall();
            ok = true;
        }
        sn = new SearchNode(tmp, op + "d");
        return(ok);
    }
Ejemplo n.º 2
0
    public int Fall()
    {
        Vector2Int newPosition = activeMino.GetPosition();

        newPosition.y -= 1;
        if (field.IsValid(activeMino, activeMino.GetRotationId(), newPosition))
        {
            activeMino.Fall();
            operation += "d";
            return(0);
        }
        else
        {
            return(-1);
        }
    }
Ejemplo n.º 3
0
    public bool HardDrop(Field field, out SearchNode sn)
    {
        Vector2Int newPos = mino.position;
        Mino       tmp    = mino.Clone();
        bool       ok     = false;

        newPos.y--;
        string hd = "";

        while (field.IsValid(mino, newPos))
        {
            tmp.Fall();
            hd += "d";
            ok  = true;
            newPos.y--;
        }
        sn = new SearchNode(tmp, op + hd);
        return(ok);
    }