private void PlaySound(EventBaseData ev) { if (eventSounds.ContainsKey(ev.GetType().ToString())) { PlaySound(eventSounds[ev.GetType().ToString()]); } }
public void TriggerEvent(EventBaseData e) { EventDelegate del; if (delegates.TryGetValue(e.GetType(), out del)) { del.Invoke(e); foreach (EventDelegate k in delegates[e.GetType()].GetInvocationList()) { if (onceLookups.ContainsKey(k)) { delegates[e.GetType()] -= k; if (delegates[e.GetType()] == null) { delegates.Remove(e.GetType()); } registeredDeligates.Remove(onceLookups[k]); onceLookups.Remove(k); } } } if (delegates.TryGetValue(typeof(EventBaseData), out del)) { del.Invoke(e); } }