public void UnsubscribeVector2Event(InputGlobals.EventsV2Enum vector2enum, InputGlobals.EventV2 callback) { InputGlobals.EventV2 even; _eventsVector2.TryGetValue(vector2enum, out even); if (even != null) { even -= callback; } }
/// <summary> /// unsubscribes all callbacks from event by enum name /// </summary> /// <param name="vector2enum"></param> private void UnsubscribeVector2Event(InputGlobals.EventsV2Enum vector2enum) { InputGlobals.EventV2 even; _eventsVector2.TryGetValue(vector2enum, out even); if (even != null) { even = null; } }
public void SubscribeVector2Event(InputGlobals.EventsV2Enum vector2enum, InputGlobals.EventV2 callback) { if (_eventsVector2.Count == 0) { FillUpDictionaryEventsV2(); } string str = ""; foreach (var k in _eventsVector2) { str += k.Key.ToString() + " ; "; } _eventsVector2[vector2enum] += callback; }
private void InvokeEventV2(InputGlobals.EventsV2Enum enu, Vector2 vector) { InputGlobals.EventV2 even; _eventsVector2.TryGetValue(enu, out even); even?.Invoke(vector); }