Beispiel #1
0
 public void UnregisterListener(EBlockMotionEvent motionEvent, Action onEvent)
 {
     if (_listeners.ContainsKey(motionEvent))
     {
         _listeners[motionEvent] -= onEvent;
     }
 }
 private void TryFireEvent(EBlockMotionEvent eventType, KeyCode keyCode)
 {
     if (!Input.GetKeyDown(keyCode))
     {
         return;
     }
     _owner._listeners.TryGetValue(eventType, out var action);
     action?.Invoke();
 }
Beispiel #3
0
        public void RegisterListener(EBlockMotionEvent motionEvent, Action onEvent)
        {
            if (_listeners.ContainsKey(motionEvent))
            {
                _listeners[motionEvent] += onEvent;
                return;
            }

            _listeners[motionEvent] = onEvent;
        }