예제 #1
0
        public void FinishTurn()
        {
            var side         = Sides[(int)Chess.InverseColor(Logic.Turn)];
            var opponent     = side.GetPlayer();
            var opponentGuid = side.PlayerGuid;

            if (side != null && !side.IsAi())
            {
                SendMoveResponse(opponent, MoveResult);
            }

            side = Sides[(int)Logic.Turn];
            if (side != null)
            {
                if (side.IsAi())
                {
                    AiState = ChessAiState.WaitingToStart;
                }
                else
                {
                    var move  = Logic.GetLastMove();
                    var piece = Logic.GetPiece(move.To);
                    var data  = new GameMoveData(ChessMoveType.FromTo, move.Color, move.From, move.To);
                    SendOpponentTurn(side.GetPlayer(), opponentGuid, piece, data);
                }
            }
        }
예제 #2
0
 public void SendOpponentTurn(Player player, ObjectGuid opponentGuid, BasePiece piece, GameMoveData data)
 {
     player.Session.Network.EnqueueSend(new GameEventOpponentTurn(player.Session, ChessBoard.Guid, new ChessMoveData(opponentGuid, piece.Guid, data)));
 }