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);
            }
        }
Пример #2
0
 public void Publish(object sender)
 {
     EventSystemManager.Publish(sender, this);
 }
Пример #3
0
 public void Publish()
 {
     EventSystemManager.Publish(null, this);
 }