Example #1
0
 /// <summary>
 /// Get behaviour instance of the given type
 /// </summary>
 /// <param name="behaviourType"></param>
 /// <returns>the instance, return null if the instance with the given type is not found</returns>
 public BehaviourInstanceBase GetBehaviour(BehaviourTypeSO behaviourType)
 {
     for (int i = 0; i < Behaviours.Count; i++)
     {
         var behaviourInstance = Behaviours[i];
         if (behaviourInstance.BehaviourSO.GetInstanceID() == behaviourType.GetInstanceID())
         {
             return(behaviourInstance);
         }
     }
     return(null);
 }
Example #2
0
 public bool HasBehaviour(BehaviourTypeSO behaviourType)
 {
     for (int i = 0; i < Behaviours.Count; i++)
     {
         var behaviourInstance = Behaviours[i];
         if (behaviourInstance.BehaviourSO.GetInstanceID() == behaviourType.GetInstanceID())
         {
             return(true);
         }
     }
     return(false);
 }