Class AssignRole
The overmind urge responsible for assigning roles.
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain.Overmind
Assembly: BotBrain.Overmind.dll
Syntax
public class AssignRole : OvermindUrgeBase, IUrge<OvermindState, OvermindBot, OvermindAction>, IUrge, IEquatable<IUrge?>
Remarks
Initializes a new instance of the AssignRole class.
Constructors
View SourceAssignRole(string?, ILogger<AssignRole>?)
The overmind urge responsible for assigning roles.
Declaration
public AssignRole(string? name = null, ILogger<AssignRole>? logger = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The urge name. |
ILogger<AssignRole> | logger | The logger to use. |
Remarks
Initializes a new instance of the AssignRole class.
Methods
View SourceAssignToScenario(IDevice, DeviceState, IScenario, OvermindState)
Creates a bot action to assign the device to a scenario.
Declaration
protected virtual OvermindAction? AssignToScenario(IDevice device, DeviceState subbot, IScenario scenario, OvermindState state)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device. |
DeviceState | subbot | The device state. |
IScenario | scenario | The scenario. |
OvermindState | state | The overmind state. |
Returns
Type | Description |
---|---|
OvermindAction | An overmind action. |
CanAssignToScenario(IDevice, OvermindBot, IScenario)
Determines if the given device can be assigned to a scenario.
Declaration
protected virtual bool CanAssignToScenario(IDevice device, OvermindBot bot, IScenario scenario)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device. |
OvermindBot | bot | The overmind bot. |
IScenario | scenario | The scenario. |
Returns
Type | Description |
---|---|
bool | True if the device can be assigned to the scenario. |
CanRunScenario(IScenario, bool)
Determines if the given scenario can run.
Declaration
protected virtual bool CanRunScenario(IScenario scenario, bool isFirst)
Parameters
Type | Name | Description |
---|---|---|
IScenario | scenario | The scenario. |
bool | isFirst | True if this is the next scenario in the quality pass. |
Returns
Type | Description |
---|---|
bool | True if the scenario is next or it can run concurrently. |
DoesScenarioNeedUpdate(IScenario)
Determines if the given scenario needs additional devices to run.
Declaration
protected virtual bool DoesScenarioNeedUpdate(IScenario scenario)
Parameters
Type | Name | Description |
---|---|---|
IScenario | scenario | The scenario. |
Returns
Type | Description |
---|---|
bool | True if the scenario doesn't have enough devices to run and isn't finished. |
IsScenarioRunningExclusively(IScenario)
Determines if the given scenario is running and should prevent other scenarios from starting.
Declaration
protected virtual bool IsScenarioRunningExclusively(IScenario scenario)
Parameters
Type | Name | Description |
---|---|---|
IScenario | scenario | The scenario. |
Returns
Type | Description |
---|---|
bool | True if the scenario is non-concurrent and running with enough devices. |
RunSync(OvermindState, OvermindBot)
Runs the urge synchronously.
Declaration
protected override IEnumerable<IRecommendedAction<OvermindAction>> RunSync(OvermindState state, OvermindBot bot)
Parameters
Type | Name | Description |
---|---|---|
OvermindState | state | The game state. |
OvermindBot | bot | The bot to control. |
Returns
Type | Description |
---|---|
IEnumerable<IRecommendedAction<OvermindAction>> | An enumerable of weighted bot actions. |