using System.Collections; using System.Collections.Generic; using UnityEngine; namespace KairoEngine.Core { public static class GenericEventsStoryExtensions { public static Dictionary> list = new Dictionary>(); public static void StartListening(this GenericEvents e, string title, System.Action listener) { System.Action action = null; if (list.TryGetValue(title, out action)) { action += listener; list[title] = action; } else { action += listener; list.Add(title, action); } } public static void StopListening(this GenericEvents e,string title, System.Action listener) { System.Action action = null; if (list.TryGetValue(title, out action)) { action -= listener; list[title] = action; } } public static void Trigger(this GenericEvents e, string title, StoryStepData storyStepData) { System.Action action = null; if (list.TryGetValue(title, out action)) { if(action != null) action(storyStepData); } } } }