diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/Math/RandomBool.cs')
-rw-r--r-- | Client/Assets/Behavior Designer/Runtime/Basic Tasks/Math/RandomBool.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Math/RandomBool.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Math/RandomBool.cs new file mode 100644 index 00000000..2cb731d3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Math/RandomBool.cs @@ -0,0 +1,23 @@ +using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.Math
+{
+ [TaskCategory("Basic/Math")]
+ [TaskDescription("Sets a random bool value")]
+ public class RandomBool : Action
+ {
+ [Tooltip("The variable to store the result")]
+ public SharedBool storeResult;
+
+ public override TaskStatus OnUpdate()
+ {
+ storeResult.Value = Random.value < 0.5f;
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ storeResult.Value = false;
+ }
+ }
+}
\ No newline at end of file |