Beispiel #1
0
        // Player constructor
        public ChessMove(Square initialSquare, Square targetSquare, float rating)
        {
            InitialSquare = initialSquare;
            TargetSquare  = targetSquare;
            if (ChessGrid.Pieces.ContainsKey(targetSquare))
            {
                Attack = (ChessGrid.GetPosition(targetSquare) != null);
            }
            Rating = rating;

            if (!Attack)
            {
                return;
            }
            ChessPiece piece = ChessGrid.GetPosition(initialSquare);

            if (piece.type == "knight")
            {
                ChessPiece        target       = ChessGrid.GetPosition(targetSquare);
                List <ChessPiece> surroundings = MovementUtil.SurroundingPieces(ChessGrid.Pieces, initialSquare);
                if (!surroundings.Contains(target))
                {
                    AddOne = true;
                }
            }
        }
Beispiel #2
0
 private void Awake()
 {
     Instance = this;
 }