Пример #1
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);
            }
        }
Пример #2
0
        public static NetBehaviour Create <T>(GameObject gameObject, int owner, NetGUID guid) where T : NetBehaviour
        {
            var behaviour = gameObject.AddComponent <T>();

            behaviour.guid = guid;
            guid.behaviour = behaviour;

            behaviour.PrivateInit(owner);

            behaviour.Init();

            return(behaviour);
        }
Пример #3
0
 /// <summary>
 /// Send a GUID broadcast to the appropriate object
 /// </summary>
 /// <param name="gb"></param>
 private static void ProcessGUIDBroadcast(GUIDBroadcast gb)
 {
     NetGUID.SendEvent(gb.guid, gb.e);
 }
Пример #4
0
 private void _AddToMap(NetGUID guid)
 {
     map.Add(guid.id, guid);
 }
Пример #5
0
 public static void AddToMap(NetGUID guid)
 {
     instance?._AddToMap(guid);
 }
Пример #6
0
 private void _AddGUID(NetGUID guid)
 {
     waitingGUIDs.Enqueue(guid);
     NetworkClient.SendObjectToServerTCP(NetworkControlCode.runOnServer, new GUIDRequest());
 }
Пример #7
0
 public static void AddGUID(NetGUID guid)
 {
     instance?._AddGUID(guid);
 }
Пример #8
0
 public void BroadcastToSelfUdp(NetworkedCEvent e)
 {
     NetGUID.SendEventToServerUdp(guid.id, e);
 }
Пример #9
0
 public void SetGUID(NetGUID guid)
 {
     this.guid = guid;
 }