public static void SubscribeEventHandlers <T>(this T obj) { var methods = obj.GetMethodsWithAttribute <T, SubscribeEventHandlerAttribute>(); for (int i = 0; i < methods.Length; i++) { var attribute = methods[i].GetCustomAttribute <SubscribeEventHandlerAttribute>(); var handler = Delegate.CreateDelegate(typeof(GameEventHandler), obj, methods[i]) as GameEventHandler; EventSystemManager.Subscribe(attribute.EventType, handler); } }
public void Publish(object sender) { EventSystemManager.Publish(sender, this); }
public void Publish() { EventSystemManager.Publish(null, this); }