Class OvermindState
Represents the overmind bot state.
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain.Overmind
Assembly: BotBrain.Overmind.dll
Syntax
public class OvermindState : EventPublisher<OvermindEventArgs>, IEventAggregator<OvermindEventArgs>, IEventPublisher<OvermindEventArgs>, IEventProcessor
Constructors
View SourceOvermindState(ILogger<OvermindState>, IBrainHelper)
Initializes a new instance of the OvermindState class.
Declaration
public OvermindState(ILogger<OvermindState> logger, IBrainHelper brainHelper)
Parameters
Type | Name | Description |
---|---|---|
ILogger<OvermindState> | logger | The logger to use. |
IBrainHelper | brainHelper | The brain helper for sub-bots. |
Properties
View SourceBrainHelper
Gets the brain helper for sub-bots.
Declaration
public IBrainHelper BrainHelper { get; }
Property Value
Type | Description |
---|---|
IBrainHelper |
Devices
Gets a mapping from each device to sub-bot controlled by this overmind.
Declaration
public IReadOnlyDictionary<IDevice, DeviceState> Devices { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<IDevice, DeviceState> |
FinishedScenarios
Gets the collection of scenarios this overmind has finished.
Declaration
public Collection<IScenario> FinishedScenarios { get; }
Property Value
Type | Description |
---|---|
Collection<IScenario> |
Logger
Gets the logger.
Declaration
public ILogger<OvermindState> Logger { get; }
Property Value
Type | Description |
---|---|
ILogger<OvermindState> |
RecentEvents
Gets a read-only list of recent events.
Declaration
public IReadOnlyList<OvermindEventArgs> RecentEvents { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<OvermindEventArgs> |
Methods
View SourceClearEvents()
Clears the list of events.
Declaration
public void ClearEvents()
FinishScenario(IScenario)
Finishes a scenario by removing any assigned devices.
Declaration
public void FinishScenario(IScenario scenario)
Parameters
Type | Name | Description |
---|---|---|
IScenario | scenario | The scenario. |
GetRoles(IRoleBasedScenario)
Gets an enumeration of assigned roles in a scenario.
Declaration
public IEnumerable<(DeviceState State, IRoleBasedScenario Scenario, IRole? Role)> GetRoles(IRoleBasedScenario scenario)
Parameters
Type | Name | Description |
---|---|---|
IRoleBasedScenario | scenario | The scenario. |
Returns
Type | Description |
---|---|
IEnumerable<(DeviceState State, IRoleBasedScenario Scenario, IRole Role)> | Each in-use device's state, scenario, and role. |
GetRoles(OvermindBot)
Gets an enumeration of assigned roles.
Declaration
public IEnumerable<(DeviceState State, IRoleBasedScenario Scenario, IRole? Role)> GetRoles(OvermindBot bot)
Parameters
Type | Name | Description |
---|---|---|
OvermindBot | bot | The overmind bot. |
Returns
Type | Description |
---|---|
IEnumerable<(DeviceState State, IRoleBasedScenario Scenario, IRole Role)> | Each in-use device's state, scenario, and role. |
GetRoles(OvermindSettings)
Gets an enumeration of assigned roles.
Declaration
public IEnumerable<(DeviceState State, IRoleBasedScenario Scenario, IRole? Role)> GetRoles(OvermindSettings settings)
Parameters
Type | Name | Description |
---|---|---|
OvermindSettings | settings | The overmind settings. |
Returns
Type | Description |
---|---|
IEnumerable<(DeviceState State, IRoleBasedScenario Scenario, IRole Role)> | Each in-use device's state, scenario, and role. |
OnScenarioFailed(IScenario, string?)
Publishes the failed scenario event.
Declaration
public void OnScenarioFailed(IScenario scenario, string? message = null)
Parameters
Type | Name | Description |
---|---|---|
IScenario | scenario | The scenario that failed. |
string | message | The reason the scenario failed. |
OnScenarioStarted(IScenario)
Publishes the start scenario event.
Declaration
public void OnScenarioStarted(IScenario scenario)
Parameters
Type | Name | Description |
---|---|---|
IScenario | scenario | The scenario that is starting. |
ProcessEvents()
Processes an internal buffer of events.
Declaration
public void ProcessEvents()
Reset(IDevice)
Resets a device's state in the overmind.
Declaration
public void Reset(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device. |
Update(DeviceState)
Updates a device's state in the overmind.
Declaration
public void Update(DeviceState state)
Parameters
Type | Name | Description |
---|---|---|
DeviceState | state | The device state. |