示例#1
0
 public void SetBehaviour(GameObject gameObject)
 {
     if (gameObject != null)
     {
         manager = gameObject.GetComponentInChildren <BehaviourManager>();
         if (manager != null && !string.IsNullOrEmpty(_behaviourName))
         {
             manager.ActivateBehavior(_behaviourName);
         }
     }
 }
示例#2
0
        private void OnEnable()
        {
            behaviourManager = target as BehaviourManager;
            var behaviorsList = behaviourManager.GetType().GetField("_behaviours", BindingFlags.NonPublic | BindingFlags.Instance);

            defaultBehavior = behaviourManager.GetType().GetField("_defaultBehavior", BindingFlags.NonPublic | BindingFlags.Instance);

            _behaviours = (List <BehaviourDefinition>)behaviorsList.GetValue(behaviourManager);

            GetBehaviorNames();
        }