Esempio n. 1
0
        /// <summary>
        /// Call to execute actions.
        /// </summary>
        protected void OnEvent()
        {
            if (Disable)
            {
                return;
            }

            int count = m_actions.Count;

            for (int i = 0; i < count; i++)
            {
                INotify notify = m_actions[i];

                if (notify is Notify)
                {
                    Notify n = notify as Notify;
                    n.action(gameObject);
                }
                else if (notify is NotifyWithArg)
                {
                    NotifyWithArg n = notify as NotifyWithArg;
                    n.action(gameObject, n.arg);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Add a action with a argument.
        /// </summary>
        public void AddAction(Action<GameObject, object> action, object arg)
        {
            NotifyWithArg notify = new NotifyWithArg();
            notify.action = action;
            notify.arg = arg;

            m_actions.Add(notify);
        }
Esempio n. 3
0
        /// <summary>
        /// Add a action with a argument.
        /// </summary>
        public void AddAction(Action <GameObject, object> action, object arg)
        {
            NotifyWithArg notify = new NotifyWithArg();

            notify.action = action;
            notify.arg    = arg;

            m_actions.Add(notify);
        }