public DeepBehavior AddBehavior(DeepBehavior behavior) { behavior.parent = this; behaviors.Add(behavior); behavior.IntitializeBehavior(); return(behavior); }
public bool RemoveBehavior(DeepBehavior behavior) { if (!behaviors.Contains(behavior)) { return(false); } behavior.DestroyBehavior(); behaviors.Remove(behavior); return(true); }
public DeepBehavior AddBehavior(Type behavior) { if (!typeof(DeepBehavior).IsAssignableFrom(behavior)) { return(null); // >:( } DeepBehavior b = (DeepBehavior)Activator.CreateInstance(behavior); return(AddBehavior(b)); }
public DeepBehavior AddBehavior <T>() where T : DeepBehavior { DeepBehavior b = (DeepBehavior)Activator.CreateInstance(typeof(T)); return(AddBehavior(b)); }