Class RandomDecisionBehaviour
- Namespace
- LibGameAI.DecisionTrees
- Assembly
- DecisionTrees.dll
Helper class which performs a random decision and maintains it during a specified duration and while the tree node containing it continues to be invoked every frame.
public class RandomDecisionBehaviour
- Inheritance
-
RandomDecisionBehaviour
- Inherited Members
Constructors
RandomDecisionBehaviour(Func<float>, Func<float>, float, float)
Creates a new random decision behaviour.
public RandomDecisionBehaviour(Func<float> nextRandValFunc, Func<float> getTimeFunc, float timeoutDuration, float trueProb = 0.5)
Parameters
nextRandValFunc
Func<float>A function which returns a random value between 0 and 1.
getTimeFunc
Func<float>A function which returns the current time.
timeoutDuration
floatHow many seconds before this decision times out.
trueProb
floatProbability of a true decision (0.5f by default).
Methods
RandomDecision()
Makes a true or false decision, or keeps the previous decision if the world state hasn't changed and the decision hasn't timed out.
public bool RandomDecision()
Returns
- bool
True or false.