コード例 #1
0
    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;
        }
    }
コード例 #2
0
    /// <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;
        }
    }
コード例 #3
0
 public void RegisterLaserEvent(Light2DEvent e)
 {
     m_LaserHitEvents += e;
 }
コード例 #4
0
ファイル: Light2D.cs プロジェクト: williamd4112/GGJ2016
    /// <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;
    }