private void ClientProcessServerMessages()
    {
        while (m_ClientServerReceivedMessages.Count > 0)
        {
            ServerPosition serverMessage = m_ClientServerReceivedMessages.Dequeue();

            // Hack??? Needed to get around setting position.
            m_Player1.GetComponent <CharacterController>().enabled = false;
            m_Player1.transform.position = serverMessage.Position;
            m_Player1.GetComponent <CharacterController>().enabled = true;
            if (ServerReconcile)
            {
                int i = 0;
                while (i < m_ClientPendingInputsToServer.Count)
                {
                    Inputs h = m_ClientPendingInputsToServer[i];
                    if (h.SeqNum <= serverMessage.LastProcessedSeqNum)
                    {
                        m_ClientPendingInputsToServer.RemoveAt(i);
                    }
                    else
                    {
                        // Not processed by server yet. Re-Apply.
                        ApplyInput(h);
                        i++;
                    }
                }
            }
            else
            {
                m_ClientPendingInputsToServer.Clear();
            }
        }
    }
Exemplo n.º 2
0
    Thread connectThread;             //連接線程

    void Awake()
    {
        current = this;
    }
Exemplo n.º 3
0
 public override string ToString()
 {
     return($"ID:{ID}, Position:{ServerPosition.ToString()}, LookAtRadian:{LookAtRadian}, FeetRadian:{FeetRadian}");
 }