Ejemplo n.º 1
0
        public override void Instantiate(GraphReference instance)
        {
            base.Instantiate(instance);

            var data = instance.GetElementData <Data>(this);

            if (this is IGraphEventListener listener && data.isActive)
            {
                listener.StartListening(instance);
            }
Ejemplo n.º 2
0
        public override EventHook GetHook(GraphReference reference)
        {
            if (!reference.hasData)
            {
                return(hookName);
            }

            var data = reference.GetElementData <Data>(this);

            return(new EventHook(hookName, data.target));
        }
Ejemplo n.º 3
0
        public override void Uninstantiate(GraphReference instance)
        {
            // Here, we're relying on the fact that OnDestroy calls Uninstantiate.
            // We need to force-dispose any remaining coroutine to avoid
            // memory leaks, because OnDestroy on the runner will not keep
            // executing MoveNext() until our soft-destroy call at the end of Flow.Coroutine
            // or even dispose the coroutine's enumerator (!).
            var data       = instance.GetElementData <Data>(this);
            var coroutines = data.activeCoroutines.ToHashSetPooled();

#if UNITY_EDITOR
            new FrameDelayedCallback(() => StopAllCoroutines(coroutines), 1);
#else
            StopAllCoroutines(coroutines);
#endif

            base.Uninstantiate(instance);
        }
Ejemplo n.º 4
0
        public override EventHook GetHook(GraphReference reference)
        {
            var refData = reference.GetElementData <Data>(this);

            return(ConstructHook(refData.target, _eventType));
        }