public void Instanced_Event_Invoked() { var floatEvent = ScriptableObject.CreateInstance(typeof(FloatEvent)) as FloatEvent; var floatEventReference = new FloatEventReference(); floatEventReference.Type = ReferenceType.Instanced; floatEventReference.Event = floatEvent; var gameObject = new GameObject(); var instancedVariableOwner = gameObject.AddComponent <InstanceOwner>(); floatEventReference.Connection = instancedVariableOwner; bool pass = false; float passedValue = 0f; floatEventReference.AddListener(delegate(float f) { pass = true; passedValue = f; }); floatEventReference.Invoke(5f); Assert.IsTrue(pass); Assert.AreEqual(5f, passedValue); }
public void Shared_Event_Invoked() { var floatEvent = ScriptableObject.CreateInstance(typeof(FloatEvent)) as FloatEvent; var floatEventReference = new FloatEventReference(); floatEventReference.Type = ReferenceType.Shared; floatEventReference.Event = floatEvent; bool pass = false; float passedValue = 0f; floatEventReference.AddListener(delegate(float f) { pass = true; passedValue = f; }); floatEventReference.Invoke(5f); Assert.IsTrue(pass); Assert.AreEqual(5f, passedValue); }