From 22891bf59032ba88262824255a706d652031384b Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 10 Mar 2022 14:07:40 +0800 Subject: * move folder --- .../Runtime/Conditionals/RandomProbability.cs | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 Assets/ThirdParty/Behavior Designer/Runtime/Conditionals/RandomProbability.cs (limited to 'Assets/ThirdParty/Behavior Designer/Runtime/Conditionals/RandomProbability.cs') diff --git a/Assets/ThirdParty/Behavior Designer/Runtime/Conditionals/RandomProbability.cs b/Assets/ThirdParty/Behavior Designer/Runtime/Conditionals/RandomProbability.cs deleted file mode 100644 index e971bb3d..00000000 --- a/Assets/ThirdParty/Behavior Designer/Runtime/Conditionals/RandomProbability.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace BehaviorDesigner.Runtime.Tasks -{ - [TaskDescription("The random probability task will return success when the random probability is above the succeed probability. It will otherwise return failure.")] - [HelpURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=33")] - public class RandomProbability : Conditional - { - [Tooltip("The chance that the task will return success")] - public SharedFloat successProbability = 0.5f; - [Tooltip("Seed the random number generator to make things easier to debug")] - public SharedInt seed; - [Tooltip("Do we want to use the seed?")] - public SharedBool useSeed; - - private System.Random random; - - public override void OnAwake() - { - // If specified, use the seed provided. - if (useSeed.Value) { - random = new System.Random(seed.Value); - } else { - random = new System.Random(); - } - } - - public override TaskStatus OnUpdate() - { - // Return success if random value is less than the success probability. Otherwise return failure. - float randomValue = (float)random.NextDouble(); - if (randomValue < successProbability.Value) { - return TaskStatus.Success; - } - return TaskStatus.Failure; - } - - public override void OnReset() - { - // Reset the public properties back to their original values - successProbability = 0.5f; - seed = 0; - useSeed = false; - } - } -} \ No newline at end of file -- cgit v1.1-26-g67d0