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); }
public static GPCondition AddCondition(System.Type type, EventHandler handler) { GPCondition condition = (GPCondition)handler.GetGPActionObjectMapperOrCreate().AddCondition(type, handler); condition.SetHandler(handler); return(condition); }
public override void SetHandler(EventHandler handler) { base.SetHandler(handler); if (m_a != null) { m_a.SetHandler(handler); } }