public static void UnregisterEventListener(LightEventListenerType eventType, Light2DEvent eventMethod) { if (eventType == LightEventListenerType.OnEnter) { OnBeamEnter -= eventMethod; } if (eventType == LightEventListenerType.OnStay) { OnBeamStay -= eventMethod; } if (eventType == LightEventListenerType.OnExit) { OnBeamExit -= eventMethod; } }
/// <summary> /// Provides and easy way to register your event method. The delegate takes the form of 'Foo(Light2D, GameObject)'. /// </summary> /// <param name="_eventType">Choose from 3 event types. 'OnEnter', 'OnStay', or 'OnExit'. Does not accept flags as argument.</param> /// <param name="_eventMethod">A callback method in the form of 'Foo(Light2D, GameObject)'.</param> public static void RegisterEventListener(LightEventListenerType _eventType, Light2DEvent _eventMethod) { if (_eventType == LightEventListenerType.OnEnter) { OnBeamEnter += _eventMethod; } if (_eventType == LightEventListenerType.OnStay) { OnBeamStay += _eventMethod; } if (_eventType == LightEventListenerType.OnExit) { OnBeamExit += _eventMethod; } }
public void RegisterLaserEvent(Light2DEvent e) { m_LaserHitEvents += e; }
/// <summary> /// Provides and easy way to unregister your events. Usually used in the 'OnDestroy' and 'OnDisable' functions of your gameobject. /// </summary> /// <param name="_eventType">Choose from 3 event types. 'OnEnter', 'OnStay', or 'OnExit'. Does not accept flags as argument.</param> /// <param name="_eventMethod">The callback method you wish to remove.</param> public static void UnregisterEventListener(LightEventListenerType _eventType, Light2DEvent _eventMethod) { if (_eventType == LightEventListenerType.OnEnter) OnBeamEnter -= _eventMethod; if (_eventType == LightEventListenerType.OnStay) OnBeamStay -= _eventMethod; if (_eventType == LightEventListenerType.OnExit) OnBeamExit -= _eventMethod; }