public static void SendEvent(int guid, CEvent e) { NetBehaviour behaviour = GUIDPool.GetBehaviour(guid); if (behaviour != null) { behaviour.AcceptEvent(e); } }
private void OnDestroy() { NetBehaviourTracker.RemoveNetBehaviour(this); if (guid != null) { GUIDPool.Free(guid.id); } _OnDestroy(); }
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); } }
/// <summary> /// Accept the GUID response /// </summary> /// <param name="resp"></param> private static void ProcessGUIResponse(GUIDResponce resp) { GUIDPool.AcceptGUID(resp.guid); }
public void SetGUID(int guid) { this.id = guid; GUIDPool.AddToMap(this); eventResponse?.Invoke(this); }
public NetGUID(int guid) { this.id = guid; GUIDPool.AddToMap(this); }
public NetGUID(Action <NetGUID> eventResponse) { this.eventResponse = eventResponse; GUIDPool.AddGUID(this); }