public void SetActiveTree(ExternalBehaviorTree tree) { if (tree == null) { Debug.LogError("Null tree provided to \"SetActiveTree\" function!"); return; } ExternalBehaviorTree extree = Object.Instantiate(tree); extree.Init(); GetComponent <BehaviorTree>().DisableBehavior(); GetComponent <BehaviorTree>().ExternalBehavior = extree; GetComponent <BehaviorTree>().EnableBehavior(); }
public void SetActiveTree(AIActiveState input) { ExternalBehaviorTree extree = null; switch (input) { case AIActiveState.Calm: extree = Object.Instantiate(traits.calmTree); break; case AIActiveState.Suspicious: extree = Object.Instantiate(traits.suspiciousTree); break; case AIActiveState.Hostile: extree = Object.Instantiate(traits.hostileTree); break; } extree.Init(); GetComponent <BehaviorTree>().DisableBehavior(); GetComponent <BehaviorTree>().ExternalBehavior = extree; GetComponent <BehaviorTree>().EnableBehavior(); }