public void RecvData(SyncData data)
    {
        int notnull = (int)data.Get(typeof(int));

        //时间
        delta = Time.time - lastRecvInfoTime;
        foreach (var ai in AI_List)
        {
            string id = data.GetString();
            if (AI_List.ContainsKey(id))
            {
                //无预测同步
                //AI_List[id].transform.position = (Vector3)data.Get(typeof(Vector3));
                //AI_List[id].transform.eulerAngles = (Vector3)data.Get(typeof(Vector3));

                //预测同步
                Vector3 nPosition = (Vector3)data.Get(typeof(Vector3));
                Vector3 nRotation = (Vector3)data.Get(typeof(Vector3));
                //Debug.Log("RecvData" + id);

                NetForecastInfo(id, nPosition, nRotation);
            }
            else
            {
                data.Get(typeof(Vector3));
                data.Get(typeof(Vector3));
            }
        }
        lastRecvInfoTime = Time.time;
    }
Beispiel #2
0
 public void RecvData(SyncData data)
 {
     movementSettings.isPushed = (bool)(data.Get(typeof(bool)));
     movementSettings.isRun    = (bool)(data.Get(typeof(bool)));
 }
 public void RecvData(SyncData data)
 {
     isPushed = (bool)(data.Get(typeof(bool)));
 }