diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/ThirdParty/Behavior Designer/Runtime/Actions/StopBehaviorTree.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/ThirdParty/Behavior Designer/Runtime/Actions/StopBehaviorTree.cs')
-rw-r--r-- | Assets/ThirdParty/Behavior Designer/Runtime/Actions/StopBehaviorTree.cs | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/StopBehaviorTree.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Actions/StopBehaviorTree.cs deleted file mode 100644 index fe753c5b..00000000 --- a/Assets/ThirdParty/Behavior Designer/Runtime/Actions/StopBehaviorTree.cs +++ /dev/null @@ -1,57 +0,0 @@ -using UnityEngine;
-
-namespace BehaviorDesigner.Runtime.Tasks
-{
- [TaskDescription("Pause or disable a behavior tree and return success after it has been stopped.")]
- [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=21")]
- [TaskIcon("{SkinColor}StopBehaviorTreeIcon.png")]
- public class StopBehaviorTree : Action
- {
- [Tooltip("The GameObject of the behavior tree that should be stopped. If null use the current behavior")]
- public SharedGameObject behaviorGameObject;
- [Tooltip("The group of the behavior tree that should be stopped")]
- public SharedInt group;
- [Tooltip("Should the behavior be paused or completely disabled")]
- public SharedBool pauseBehavior = false;
-
- private Behavior behavior;
-
- public override void OnStart()
- {
- var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents<Behavior>();
- if (behaviorTrees.Length == 1) {
- behavior = behaviorTrees[0];
- } else if (behaviorTrees.Length > 1) {
- for (int i = 0; i < behaviorTrees.Length; ++i) {
- if (behaviorTrees[i].Group == group.Value) {
- behavior = behaviorTrees[i];
- break;
- }
- }
- // If the group can't be found then use the first behavior tree
- if (behavior == null) {
- behavior = behaviorTrees[0];
- }
- }
- }
-
- public override TaskStatus OnUpdate()
- {
- if (behavior == null) {
- return TaskStatus.Failure;
- }
-
- // Start the behavior and return success.
- behavior.DisableBehavior(pauseBehavior.Value);
- return TaskStatus.Success;
- }
-
- public override void OnReset()
- {
- // Reset the properties back to their original values
- behaviorGameObject = null;
- group = 0;
- pauseBehavior = false;
- }
- }
-}
\ No newline at end of file |