public sealed class SensorSetEvery sensor a world's agents read through, and the pass that runs them: globals once, locals per agent.
Remarks
Doc 37 § D13's four kinds, and the pass is where the taxonomy pays for itself. A global sensor runs once and its answer is written to every agent's board; a local one runs per agent. For "is it night" over a thousand villagers that is one query against a thousand, which is the entire reason the split exists.
⚠ A global's answer is cached at Begin and never re-read. An agent late in the pass must see the same night as one early in it — a sensor asked per agent would let the clock advance mid-pass and give two agents standing beside each other different weather, which is the class of bug nobody looks for.
⚠ Sensors write keys; they do not decide anything. A sensor that chose an action would be a planner, and the whole arrangement of this library is that there are exactly three of those. What a sensor is for is making the world sayable on a blackboard, so that a tree's decorator, a utility set's consideration and a GOAP domain's world key all read one number that was measured once.
Fields and properties (3)
public int LocalCountHow many sensors run per agent.
public int GlobalCountHow many run once a pass.
public int PassesHow many times Begin has run the globals.
Methods (8)
public SensorSet Add(BlackboardKey key, IWorldSensor sensor)Adds a per-agent world sensor writing one numeric key.
public SensorSet AddTarget(BlackboardKey position, BlackboardKey entity, ITargetSensor sensor)Adds a per-agent target sensor writing a place, a thing, or both.
public SensorSet AddGlobal(BlackboardKey key, IGlobalWorldSensor sensor)Adds a once-a-pass world sensor writing one numeric key on every agent.
public SensorSet AddGlobalTarget(BlackboardKey position, BlackboardKey entity, IGlobalTargetSensor sensor)Adds a once-a-pass target sensor writing a place, a thing, or both, on every agent.
public void Begin(World world, GameTime time)Runs every global sensor once and remembers what they said.
public int Apply(in AgentContext context)Writes what the globals said and runs every local sensor, on one agent.
public float ReadingOf(int index)What a global world sensor last said.
public SensorTarget TargetOf(int index)What a global target sensor last found.
Used by (3)
- AiSystemVixen.Ai
- SeamTestsVixen.Ai.Nodes.Tests
- VillageVixen.Ai.Nodes.Tests