public void PieceMoveEvent(BasePiece piece, Cell currentCell, Cell targetCell) { var toX = (byte)targetCell.boardPosition.x; var toY = (byte)(7 - targetCell.boardPosition.y); var fromX = (byte)currentCell.boardPosition.x; var fromY = (byte)(7 - currentCell.boardPosition.y); if (engine.MovePiece( fromX, fromY, toX, toY)) { var move = new EngineMove { MoveContent = engine.GetMoveHistory().ToArray()[0], Message = "Ход Игрока\n" }; queuedMoves.Enqueue(move); } else { SoundEvents.PlayRejectSound(); StaticEvents.LogMsgEvent("Недопустимый ход!", LogType.Warning); piece.Place(board.AllCells[currentCell.boardPosition.x, currentCell.boardPosition.y]); } }
private void MakeEngineMove() { Task <MoveContent> .Run(() => { lock (engine) { engine.AiPonderMove(); return(engine.GetMoveHistory().ToArray()[0]); } }).ContinueInMainThreadWith(t => { Debug.Log("AI Move: " + t.Result.GetPureCoordinateNotation()); if (t.Result == null) { return; } var move = new EngineMove { MoveContent = t.Result, Message = "Ход (" + engine.GameDifficulty + "AI)\n" }; queuedMoves.Enqueue(move); }); }
// Use this for initialization void Start() { PlayerMovement = this.GetComponent <EngineMove>(); //Minigun = this.GetComponent<Gun>(); }