Ejemplo n.º 1
0
        public static void SendEvent(int guid, CEvent e)
        {
            NetBehaviour behaviour = GUIDPool.GetBehaviour(guid);

            if (behaviour != null)
            {
                behaviour.AcceptEvent(e);
            }
        }
Ejemplo n.º 2
0
 private void OnDestroy()
 {
     NetBehaviourTracker.RemoveNetBehaviour(this);
     if (guid != null)
     {
         GUIDPool.Free(guid.id);
     }
     _OnDestroy();
 }
Ejemplo n.º 3
0
        public void Awake()
        {
            instance = this;
            foreach(ReservedGUID res in FindObjectsOfType<ReservedGUID>())
            {
                var id = new NetGUID(res.id);
                NetBehaviour netBehaviour = res.GetComponent<NetBehaviour>();
                netBehaviour?.SetGUID(id);
                id.behaviour = netBehaviour;

                current = System.Math.Max(current, res.id + 1);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Accept the GUID response
 /// </summary>
 /// <param name="resp"></param>
 private static void ProcessGUIResponse(GUIDResponce resp)
 {
     GUIDPool.AcceptGUID(resp.guid);
 }
Ejemplo n.º 5
0
 public void SetGUID(int guid)
 {
     this.id = guid;
     GUIDPool.AddToMap(this);
     eventResponse?.Invoke(this);
 }
Ejemplo n.º 6
0
        public NetGUID(int guid)
        {
            this.id = guid;

            GUIDPool.AddToMap(this);
        }
Ejemplo n.º 7
0
 public NetGUID(Action <NetGUID> eventResponse)
 {
     this.eventResponse = eventResponse;
     GUIDPool.AddGUID(this);
 }