Class AUnitySensor
Use this class to create sensors that have to execute code in Unity's thread You need to call the base constructor when inheriting this class and implement the Init (optional) and SafeSensorCheck (mandatory) methods
Inherited Members
Namespace: Xareus.Scenarios.Unity
Assembly: Xareus.Scenarios.Unity.dll
Syntax
public abstract class AUnitySensor : ASensor
Constructors
AUnitySensor(Event, Dictionary<string, Parameter>, IContext, IContext, IContext)
Declaration
protected AUnitySensor(Event @event, Dictionary<string, Parameter> parameters, IContext externalContext, IContext scenarioContext, IContext sequenceContext)
Parameters
Type | Name | Description |
---|---|---|
Event | event | |
Dictionary<string, Parameter> | parameters | |
IContext | externalContext | |
IContext | scenarioContext | |
IContext | sequenceContext |
Methods
FillParameters()
Override the base method as we need to execute this in the Unity thread
Declaration
public override void FillParameters()
Overrides
Init()
Initialize a sensor. Note that this code will be executed in unity's thread and the declared parameters (using the ConfigurationParameter attribute) are already filled
Declaration
[Obsolete("Use the SafeReset method instead")]
public virtual void Init()
Reset()
Declaration
public override void Reset()
Overrides
SafeReset()
Reset a sensor. Note that this code will be executed in unity's thread and the declared parameters (using the ConfigurationParameter attribute) are already filled
Declaration
public virtual void SafeReset()
SafeSensorCheck()
This method is called at each scenario update. Note that this code will be executed in unity's thread
Declaration
public abstract ASensor.Result SafeSensorCheck()
Returns
Type | Description |
---|---|
ASensor.Result |
SafeStopCheck()
Stops a sensor. Note that this code will be executed in unity's thread and the declared parameters (using the ConfigurationParameter attribute) are already filled
Declaration
public virtual void SafeStopCheck()
SensorCheck()
SensorCheck() This method is called at each scenario update (NextStep)? If the scenario is running in a thread different from Unity's thread, SafeSensorCheck() will be called. If the Result object returns true, the transition holding the sensor is triggered
Declaration
public override sealed ASensor.Result SensorCheck()
Returns
Type | Description |
---|---|
ASensor.Result |
Overrides
StopCheck()
Declaration
public override void StopCheck()
Overrides
UnityThreadFillParameters()
Declaration
protected void UnityThreadFillParameters()
UpdateScenario()
Call this method to force the scenario to update in the same thread it was running in. This can be used to have a more responsive scenario for sensors that depend on user inputs
Declaration
protected virtual void UpdateScenario()