protected void OnEvent() { if (NotifyOnEvent.Disable) { return; } int count = this.m_actions.Count; for (int i = 0; i < count; i++) { NotifyOnEvent.INotify notify = this.m_actions[i]; if (notify is NotifyOnEvent.Notify) { NotifyOnEvent.Notify notify2 = notify as NotifyOnEvent.Notify; notify2.action(base.gameObject); } else if (notify is NotifyOnEvent.NotifyWithArg) { NotifyOnEvent.NotifyWithArg notifyWithArg = notify as NotifyOnEvent.NotifyWithArg; notifyWithArg.action(base.gameObject, notifyWithArg.arg); } } }
public void AddAction(Action <GameObject> action) { NotifyOnEvent.Notify notify = new NotifyOnEvent.Notify(); notify.action = action; this.m_actions.Add(notify); }