コード例 #1
0
        public GPCondition AddCondition(System.Type type, EventHandler handler)
        {
            if (handler == null)
            {
                throw new System.ArgumentNullException();
            }

            if (!typeof(GPCondition).IsAssignableFrom(type))
            {
                throw new System.ArgumentException("Type " + type.FullName + " must inherit from GPCondition");
            }

            GameObject holder;

            if (!m_actionObjectMap.Dictionary.TryGetValue(handler, out holder))
            {
                holder = AddEventHandler(handler);
            }

            GPCondition condition = (GPCondition)holder.AddComponent(type);

            condition.SetHandler(handler);

            return(condition);
        }
コード例 #2
0
        public static GPCondition AddCondition(System.Type type, EventHandler handler)
        {
            GPCondition condition = (GPCondition)handler.GetGPActionObjectMapperOrCreate().AddCondition(type, handler);

            condition.SetHandler(handler);

            return(condition);
        }
コード例 #3
0
        public override void SetHandler(EventHandler handler)
        {
            base.SetHandler(handler);

            if (m_a != null)
            {
                m_a.SetHandler(handler);
            }
        }