Esempio n. 1
0
        private void Awake()
        {
            var messagesManager = Loader.Instance.Network.MessagesManager;

            if (messagesManager != null)
            {
                idsRegister = new IdsRegister(Loader.Instance.Network.MessagesManager,
                                              new SimpleIdManager(), Loader.Instance.Network.IsMaster, "ControllablesIdsRegister");
                messagesManager.RegisterObject(this);
                messagesManager.RegisterObject(idsRegister);
                idsRegister.SelfRegister();
            }
        }
Esempio n. 2
0
        private void OnDestroy()
        {
            var messagesManager = Loader.Instance.Network.MessagesManager;

            if (messagesManager != null)
            {
                for (var i = Controllables.Count - 1; i >= 0; i--)
                {
                    var controllable = Controllables[i];
                    UnregisterControllable(controllable);
                }

                messagesManager.UnregisterObject(this);
                messagesManager.UnregisterObject(idsRegister);
                idsRegister = null;
            }
        }