예제 #1
0
        public void StopListening(GraphStack stack)
        {
            var data = stack.GetElementData <Data>(this);

            if (!data.isListening)
            {
                return;
            }

            var hook = new EventHook(EventHooks.Update, stack.machine);

            EventBus.Unregister(hook, data.update);
            data.update      = null;
            data.isListening = false;
        }
예제 #2
0
        public virtual void StopListening(GraphStack stack)
        {
            var data = stack.GetElementData <Data>(this);

            if (!data.isListening)
            {
                return;
            }

            // The coroutine's flow will dispose at the next frame, letting us
            // keep the current flow for clean up operations if needed
            foreach (var activeCoroutine in data.activeCoroutines)
            {
                activeCoroutine.StopCoroutine(false);
            }

            if (register)
            {
                EventBus.Unregister(data.hook, data.handler);
                data.handler = null;
            }

            data.isListening = false;
        }