Vixen
caa30e12
csharp
public sealed class RandomChanceDecorator

Passes with a fixed probability, from the agent's own stream.

Read the guide page for this →

Remarks

Drawn from AgentRandom salted by the node, so it is the same answer on every machine for the same agent on the same node — and a different answer for the agent beside it, which is the point. A shared generator here would be a desync per NPC per second.

Fields and properties (1)

  • public override int StateSize

Methods (3)

  • public RandomChanceDecorator(float probability)

    Passes with a fixed probability, from the agent's own stream.

  • public override bool Evaluate(in BehaviorContext context, ReadOnlySpan<byte> state)

    Whether the node may be entered, or may keep running.

  • public override void Enter(in BehaviorContext context, Span<byte> state)

    The node is being entered.

Used by (2)

  • BehaviorTreeDecoratorTestsVixen.Ai.Tests
  • BuildStateVixen.Ai