Class Controller
Configurable and startable controller.
Implements
Namespace: ArucoUnity
Assembly: Assembly-CSharp.dll
Syntax
public abstract class Controller : MonoBehaviour, IController
Remarks
It can have other configurable controllers as dependencies. They must have started before starting this controller. They stop this controller when one of them stops.
Properties
| Improve this Doc View SourceAutoStart
Gets or sets if configuring and starting automatically when when all dependencies started. Manually configure and start by calling Configure() and StartController().
Declaration
public bool AutoStart { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsConfigured
Gets if the controller is configured.
Declaration
public bool IsConfigured { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsReady
Gets if the controller is ready to be started when all dependencies have started.
Declaration
public bool IsReady { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsStarted
Gets if the controller is started.
Declaration
public bool IsStarted { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceAddDependency(IController)
Add a new dependency. The controller must be stopped.
Declaration
public void AddDependency(IController dependency)
Parameters
Type | Name | Description |
---|---|---|
IController | dependency | The dependency to add. |
Awake()
Initializes the properties.
Declaration
protected virtual void Awake()
Configure()
Configures the controller and calls the Configured event. Properties must be set and the controller must be stopped.
Declaration
public void Configure()
Configuring()
Declaration
protected virtual void Configuring()
GetDependencies()
Gets the list of the dependencies.
Declaration
public List<IController> GetDependencies()
Returns
Type | Description |
---|---|
List<IController> | The list of the dependencies of this instance. |
OnConfigured()
Sets IsConfigured to true, calls Configured and if all dependencies started calls ArucoUnity.Controller.OnReady.
Declaration
protected virtual void OnConfigured()
OnDestroy()
Calls StopController() if it has been configured and started.
Declaration
protected virtual void OnDestroy()
OnStarted()
Declaration
protected virtual void OnStarted()
OnStopped()
Declaration
protected virtual void OnStopped()
RemoveDependency(IController)
Remove a dependency. The controller must be stopped.
Declaration
public void RemoveDependency(IController dependency)
Parameters
Type | Name | Description |
---|---|---|
IController | dependency | The dependency to remove. |
Start()
Calls ArucoUnity.Controller.SetAutoStart(System.Boolean).
Declaration
protected virtual void Start()
StartController()
Starts the controller and calls the Started event. The controller must be configured, ready and stopped.
Declaration
public void StartController()
Starting()
Declaration
protected virtual void Starting()
StopController()
Stops the controller and calls the Stopped event. The controller must be configured and started.
Declaration
public void StopController()
Stopping()
Declaration
protected virtual void Stopping()
Events
| Improve this Doc View SourceConfigured
Called when the controller is configured.
Declaration
public event EventHandler Configured
Event Type
Type | Description |
---|---|
EventHandler |
Ready
Called when the controller is configured and ready to be started, when all its dependencies started.
Declaration
public event EventHandler Ready
Event Type
Type | Description |
---|---|
EventHandler |
Started
Called when the controller is started.
Declaration
public event EventHandler Started
Event Type
Type | Description |
---|---|
EventHandler |
Stopped
Called when the controller is stopped.
Declaration
public event EventHandler Stopped
Event Type
Type | Description |
---|---|
EventHandler |