public static void Event(string name, string args) { if (events.ContainsKey(name)) { //int i = 0; Debug.Log("Event " + name + " passed with args:\n" + args); Delegate[] eventActions = events[name].GetInvocationList(); Debug.Log("Calling a total of " + eventActions.Length + " actions."); foreach (AchievableAction action in eventActions) { //Debug.Log("Calling action #" + ++i); Achievable achievable = action(args); if (achievable.justEarned) { sendFunc(achievable.id, achievable.OnEarnedResponse); Debug.Log("Achievable Earned " + achievable.display + "!"); } } } else { Debug.Log("Event " + name + " passed with args:\n" + args); Debug.Log("But " + name + " has not been registered."); } }
public static void Register(string id, Achievable achievable) { achievable.id = id; achievable.Register(); achievables.Add(id, achievable); }