I’m making chess where chess pieces have random abilities (like queen moves like pawn, knight moves like rook etc.), but every time when i click to chess piece it’s abilities changes(at first pawn moves like king after second click it starts going like knight), how to make it gets it’s abilities at start and saves it until game finishes without changes.
public void RandomMove()
{
System.Random randomizer = new System.Random();
for (int i = 0; i < 1; i++)
{
float funcToChoose = randomizer.Next(6);
switch (funcToChoose)
{
case 0:
King_Move();
break;
case 1:
Queen_Move();
break;
case 2:
Knight_Move();
break;
case 3:
Bishop_Move();
break;
case 4:
Rook_Move();
break;
case 5:
WhitePawn_Move();
break;
case 6:
BlackPawn_Move();
break;
}
}
}
public void InitiateMovePlates()
{
switch (this.name)
{
case "White_queen":
RandomMove();
break;
case "Black_queen":
RandomMove();
break;
case "White_knight":
RandomMove();
break;
case "Black_knight":
RandomMove();
break;
case "White_bishop":
RandomMove();
break;
case "Black_bishop":
RandomMove();
break;
case "Black_king":
RandomMove();
break;
case "White_rook":
RandomMove();
break;
case "Black_rook":
RandomMove();
break;
case "White_pawn":
RandomMove();
break;
case "Black_pawn":
RandomMove();
break;
}
}