Esempio n. 1
0
        public void SOEventTests()
        {
            //create event
            var ev = EventSO.CreateInstance <EventSO>();
            //add listener
            var evLis = new EventSOTester();

            ev.Add(evLis);
            //invoke
            ev.Fire();
            //assert value matches
            Assert.IsTrue(evLis.hasBeenFired);
            //destroy event
            UnityEngine.Object.DestroyImmediate(ev);
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EventSO eventso = target as EventSO;

            EditorGUILayout.Space();
            EditorGUILayout.PrefixLabel("Current Listeners: " + eventso.ListenerCount.ToString());
            if (Application.isPlaying && GUILayout.Button("Fire"))
            {
                eventso.Fire();
            }

            if (GUILayout.Button(new GUIContent("Attempt to Ping all Listeners", "Cannot ping Objects that are not monobehaviours")))
            {
                EditorUTIL.PingElements(eventso.Listeners);
            }
        }
Esempio n. 3
0
 public void OnEventFired(EventSO origin)
 {
     unityEvent.Invoke();
 }
Esempio n. 4
0
 public void OnEventFired(EventSO origin)
 {
     hasBeenFired = true;
 }