INSA
  • Tutorials
  • Documentation
  • Api Documentation
  • Changelog
Show / Hide Table of Contents
  • Scenario Engine
    • What is a scenario Engine?
    • Main Definitions
      • Scenario
      • Transition
      • Sensor
      • Effector
      • Context
    • All Definitions
      • Comment
      • Complex Sequence
      • Context
      • Decision Tree
      • Effector
      • Event
      • Event Context
      • External Context
      • External Scenario
      • Function
      • Node
      • Net
      • Petri-Net
      • Place
      • Safe Petri-Net
      • Scenario
      • Scenario Context
      • Sensor
      • Sequence
      • State
      • State Machine
      • Token
      • Token Assign
      • Token Merge
      • Token Split
      • Transition
    • How to deal with asynchronous events?
  • Relation Engine
    • What is a relation Engine?
  • Scenario with Relation

Sensor

A sensor is used in events/transitions. It performs checks upon the world or variables. When the sensor is valid, the transition can be fired.

The actual code of the sensor must override the SensorCheck() method and must return true when valid and false when not.

All sensors have a Negate parameter that allows users to invert the sensor logic

The return type can also contain an IContext value called the event context that can be used in the transition's effector or token assign.

Note

In Unity, it's better to use the SafeSensorCheck() or UnityStepSensorCheck() methods to ensure the code is executed in Unity's thread. See create sensor.

INSA     IRISA     Inria     Ouest Valorisation Back to top