Beispiel #1
0
    void Start()
    {
        piece = GetComponent <Chess_Piece>();

        //determine piece type
        switch (transform.name[6])
        {
        case 'P':
            PieceTypeID = 1;
            pawn        = transform.GetComponent <Pawn_Piece>();
            break;

        case 'R':
            PieceTypeID = 2;
            rook        = transform.GetComponent <Rook_Piece>();
            break;

        case 'B':
            PieceTypeID = 3;
            bishop      = transform.GetComponent <Bishop_Piece>();
            break;

        case 'H':
            PieceTypeID = 4;
            horse       = transform.GetComponent <Horse_Piece>();
            break;

        case 'Q':
            PieceTypeID = 5;
            queen       = transform.GetComponent <Queen_Piece>();
            break;

        case 'K':
            PieceTypeID = 6;
            king        = transform.GetComponent <King_Piece>();
            break;

        default:
            break;
        }

        if (transform.parent.name == "Black")
        {
            PieceTypeID += 6;
        }
    }
Beispiel #2
0
 public PassantablePawn(Pawn_Piece tempPawn, int halfturns)
 {
     this.tempPawn  = tempPawn;
     this.halfturns = halfturns;
 }