Exemple #1
0
        private static void MoveRandomPiece(ChessPieceColor color, List <ChessPiece> pieces)
        {
            MovementCommandBase movement;
            var turnPieces     = pieces.Where(p => p.Color == color).ToList();
            var nextPieceIndex = random.Next(turnPieces.Count());
            var nextPiece      = turnPieces[nextPieceIndex];
            var nextPieceType  = nextPiece.GetType();

            if (nextPieceType == typeof(Peon))
            {
                movement = new PeonMovement(boardService);
            }
            else if (nextPieceType == typeof(Horse))
            {
                movement = new HorseMovement(boardService);
            }
            else
            {
                movement = new BishopMovement(boardService);
            }

            movement.MovePiece(nextPiece);
        }
Exemple #2
0
 private void Awake()
 {
     movement = new BishopMovement();
 }