Esempio n. 1
0
    public void AddMove(CheckMovesData checkMovesData, int offset)
    {
        if (!checkMovesData._valid)
        {
            return;
        }

        Move thisMove = new Move();

        thisMove.startPosition = position;
        thisMove.endPosition   = position + checkMovesData.i * offset;
        thisMove.piece         = this;

        AvailableMoves.Add(thisMove);
    }
    //Checks if a given position+offset is valid / should break the iteration
    public static CheckMovesData CheckTile(CheckMovesData d, int offset, Piece p)
    {
        if (Board.border.Contains(p.position + d.i * offset))
        {
            d._break = true;
        }
        if (Board.myBoard[p.position + d.i * offset].active == true)
        {
            d._break = true;
        }

        d._valid = !(Board.myBoard[p.position + d.i * offset].white == p.white);

        return(d);
    }