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

            return(AddBehavior(b));
        }
Example #4
0
        public DeepBehavior AddBehavior <T>() where T : DeepBehavior
        {
            DeepBehavior b = (DeepBehavior)Activator.CreateInstance(typeof(T));

            return(AddBehavior(b));
        }