Example #1
0
    public void OnReceiveTurn(Move[][] turn)
    {
        if (otherTurn == null)
        {
            otherTurn = turn;
            return;
        }
        Debug.Assert(otherTurn[0][0].piece.owner != turn[0][0].piece.owner); // just for checking, definitely will have error in the future
        TurnLog           turnLog        = new TurnLog();
        List <PhaseLog[]> tempPhasesList = new List <PhaseLog[]>();

        for (int i = 0; i < 3; i++)
        {
            Move[] otherMoves = otherTurn[0];
            Move[] moves      = turn[0];
            Move[] allMoves   = new Move[moves.Length + otherMoves.Length];
            moves.CopyTo(allMoves, 0);
            otherMoves.CopyTo(allMoves, moves.Length);
            PhaseLog[] phaseLogs = CalculateNextPhase(allMoves);
            tempPhasesList.Add(phaseLogs);
        }
        turnLog.phases = tempPhasesList.ToArray();
        otherTurn      = null;
        networkManager.SendTurnLog(turnLog);
    }