A Sensor is a class that reads the current state of the world and provides this information to the WorldState when it's needed. The Resolver uses this information to determine the best action to perform based on the current state of the world.
Sensors can provide the values for two types of data/keys:
WorldKey: A WorldKey references a value in the world. For example AppleCount. All values must be represented by ints.
TargetKey: A TargetKey references a position in the world. For example AppleTree. All positions must be represented by Vector3.
Sensors can work in two scopes: Global or Local.
Global: These sensors give information for all agents of an AgentType. For instance, IsDaytimeSensor checks if it's day or night for everyone.
Local: They give information for just one agent. For example, ClosestAppleSensor finds the nearest apple for a specific agent.
WorldSensor
WorldSensor checks the game's situation for an agent. It uses WorldKey to show each situation. The Planner uses this to pick the best action.
Examples:
IsHungrySensor checks if the agent is hungry.
HasAppleSensor checks if the agent has an apple.
Example
To create a new WorldSensor, create a new class that inherits from LocalWorldSensorBase or GlobalWorldSensorBase and implement its Sense method.