summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-27 16:15:06 +0800
committerchai <chaifix@163.com>2021-01-27 16:15:06 +0800
commit97da432c35b8c7aaf9dd2c39e2aa4b1f55f36065 (patch)
treed9b1db5908a3a030c529e230386fe01062923b09 /Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs
parent1fe4ffba72f56ccc6a89d1896142425c666887d4 (diff)
+behaviour designer
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs')
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs b/Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs
new file mode 100644
index 00000000..05c20a68
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Actions/PerformInterruption.cs
@@ -0,0 +1,29 @@
+namespace BehaviorDesigner.Runtime.Tasks
+{
+ [TaskDescription("Perform the actual interruption. This will immediately stop the specified tasks from running and will return success or failure depending on the value of interrupt success.")]
+ [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=17")]
+ [TaskIcon("{SkinColor}PerformInterruptionIcon.png")]
+ public class PerformInterruption : Action
+ {
+ [Tooltip("The list of tasks to interrupt. Can be any number of tasks")]
+ public Interrupt[] interruptTasks;
+ [Tooltip("When we interrupt the task should we return a task status of success?")]
+ public SharedBool interruptSuccess;
+
+ public override TaskStatus OnUpdate()
+ {
+ // Loop through all of the tasks and fire an interruption. Once complete return success.
+ for (int i = 0; i < interruptTasks.Length; ++i) {
+ interruptTasks[i].DoInterrupt(interruptSuccess.Value ? TaskStatus.Success : TaskStatus.Failure);
+ }
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ // Reset the properties back to their original values.
+ interruptTasks = null;
+ interruptSuccess = false;
+ }
+ }
+} \ No newline at end of file