Exemplo n.º 1
0
        //------------------------------------------------------------------------/
        // 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:
                Scene.Dispatch(eventInstance, type.Type);
                break;
            }
            return(true);
        }
Exemplo n.º 2
0
 //------------------------------------------------------------------------/
 // Messages
 //------------------------------------------------------------------------/
 protected override void OnSelectionChanged()
 {
     base.OnSelectionChanged();
     eventObject     = (Stratus.StratusEvent)Utilities.Reflection.Instantiate(selectedClass);
     serializedEvent = new SerializedSystemObject(selectedClass, eventObject);
     //serializedEvent.Deserialize(eventDataProperty);
 }
Exemplo n.º 3
0
        void UpdateEventObject()
        {
            if (!triggerable.hasType)
            {
                return;
            }

            eventObject     = (Stratus.StratusEvent)Utilities.Reflection.Instantiate(type);
            serializedEvent = new SerializedSystemObject(type, eventObject);
            serializedEvent.Deserialize(eventDataProperty);
        }
Exemplo n.º 4
0
        void OnEvent(Stratus.StratusEvent e)
        {
            if (!e.GetType().Equals(type.Type))
            {
                return;
            }

            //if (debug)
            //  Trace.Script("Triggered by " + type.Type.Name, this);

            onTrigger.Invoke(e);
        }
        void OnEvent(Stratus.StratusEvent e)
        {
            Type eventType = e.GetType();

            if (!animatorEventTriggers.ContainsKey(eventType))
            {
                return;
            }

            string parameter = animatorEventTriggers[eventType];

            SetTrigger(parameter);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Dispatches the given event of the specified type onto this object.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="gameObj">The GameObject to which to connect to.</param>
 /// <param name="eventObj">The event object. </param>
 /// <param name="nextFrame">Whether the event should be sent next frame.</param>
 public static void Dispatch(Stratus.StratusEvent eventObj, System.Type type, bool nextFrame = false)
 {
     instance.Poke();
     Stratus.StratusEvents.Dispatch(instance.gameObject, eventObj, type, nextFrame);
 }
Exemplo n.º 7
0
 //------------------------------------------------------------------------/
 // Messages
 //------------------------------------------------------------------------/
 protected override void OnSelectionChanged()
 {
     base.OnSelectionChanged();
     eventObject     = (Stratus.StratusEvent)Utilities.StratusReflection.Instantiate(selectedClass);
     serializedEvent = new StratusSerializedEditorObject(eventObject);
 }
Exemplo n.º 8
0
        ///// <summary>
        ///// Dispatches the given event of the specified type onto this object.
        ///// </summary>
        ///// <typeparam name="T"></typeparam>
        ///// <param name="gameObj">The GameObject to which to connect to.</param>
        ///// <param name="eventObj">The event object. </param>
        ///// <param name="nextFrame">Whether the event should be sent next frame.</param>
        //public static void Dispatch<T>(this GameObject gameObj, params object[] eventParameters) where T : Stratus.Event, new()
        //{
        //  T eventObject = (T)Activator.CreateInstance(typeof(T), eventParameters);
        //  Stratus.Events.Dispatch<T>(gameObj, eventObject, false);
        //}

        /// <summary>
        /// Dispatches the given event of the specified type onto this object.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="gameObj">The GameObject to which to connect to.</param>
        /// <param name="eventObj">The event object. </param>
        /// <param name="nextFrame">Whether the event should be sent next frame.</param>
        public static void Dispatch(this GameObject gameObj, Stratus.StratusEvent eventObj, System.Type type, bool nextFrame = false)
        {
            Stratus.StratusEvents.Dispatch(gameObj, eventObj, type, nextFrame);
        }