//------------------------------------------------------------------------/
        // Methods
        //------------------------------------------------------------------------/
        /// <summary>
        /// Dispatches the event onto the given target
        /// </summary>
        /// <returns></returns>
        public bool Dispatch()
        {
            if (!hasType)
            {
                return(false);
            }

            if (eventInstance == null)
            {
                eventInstance = StratusEvent.Instantiate(type, eventData);
            }

            switch (scope)
            {
            case StratusEvent.Scope.GameObject:
                foreach (var target in targets)
                {
                    if (target)
                    {
                        target.Dispatch(eventInstance, type.Type);
                    }
                }
                break;

            case StratusEvent.Scope.Scene:
                StratusScene.Dispatch(eventInstance, type.Type);
                break;
            }
            return(true);
        }
Esempio n. 2
0
 public void DispatchToScene() => StratusScene.Dispatch(this, GetType());