// Update is called once per frame void Update() { lock (_engineCallbackParams) { if (_engineCallbackParams.Count > 0) { UnityEngine.Debug.Log(": " + _engineCallbackFunctions); _engineCallbackFunctions[0](_engineCallbackParams[0]); _engineCallbackParams.RemoveAt(0); _engineCallbackFunctions.RemoveAt(0); //threadListener.Stop(); } } lock (_engineProgress) { if (_engineProgress.Count > 0 && engineProgressBar != null) { float progress = _engineProgress[0]; _engineProgress.RemoveAt(0); Vector3 nscale = engineProgressBar.transform.localScale; nscale.x = progress; engineProgressBar.transform.localScale = nscale; } } foreach (cgChessPieceScript cp in _livePieces) { if (cp.dead && !_deadPieces.Contains(cp)) { _setDeadPiece(cp); } } for (int i = _deadPieces.Count; i > 0; i--) { if (_livePieces.Contains(_deadPieces[i - 1])) { _livePieces.Remove(_deadPieces[i - 1]); } } if (_downPiece != null) { Vector3 cursorPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z); Ray cursorRay = Camera.main.ScreenPointToRay(cursorPoint); RaycastHit hit; if (Physics.Raycast(cursorRay, out hit, 100.0f)) { _downPiece.transform.position = hit.point; } } if (Input.GetKey(KeyCode.C) && Input.GetKeyDown(KeyCode.LeftControl)) { _copyGameToClipboard(); } else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.C)) { _copyGameToClipboard(); } if (Input.GetKey(KeyCode.V) && Input.GetKeyDown(KeyCode.LeftControl)) { _pasteGameFromClipboard(); } else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.V)) { _pasteGameFromClipboard(); } if (Input.GetKey(KeyCode.F1)) { UnityEngine.Debug.Break(); } if (Input.GetKey(KeyCode.A)) { //_abstractBoard.boardToString() UnityEngine.Debug.Log(_abstractBoard.boardToString()); //UnityEngine.Debug.Log(_abstractBoard._blackKingStart); } if (Input.GetKey(KeyCode.U)) { _abstractBoard.revert(); UnityEngine.Debug.Log(_abstractBoard.boardToString()); } if (Input.GetKey(KeyCode.V)) //Perform long castling move. { List <cgSimpleMove> moves = _abstractBoard.findStrictLegalMoves(_abstractBoard.whiteTurnToMove); cgSimpleMove move = null; foreach (cgSimpleMove mv in moves) { if (mv is cgCastlingMove) { if (move == null) { move = mv; } else if (Math.Abs(move.to - move.from) < Math.Abs(mv.to - mv.to)) { move = mv; } } } _makeMove(move); } }