Interface IBotBrain<TState, TBot, TAction>
The interface for a bot brain.
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain
Assembly: BotBrain.Core.dll
Syntax
public interface IBotBrain<TState, TBot, TAction> : IUrgeList<TState, TBot, TAction>, IUrge<TState, TBot, TAction>, IBotBrain, IBasedOn<IBotBrain>, IBasedOn, IEquatable<IBotBrain?>, IUrgeList, IUrge, IEquatable<IUrge?>, IHasParameters where TBot : IAutomatedBot<TAction>
Type Parameters
Name | Description |
---|---|
TState | A title-specific state object. |
TBot | A title-specific bot object that implements IAutomatedBot<TAction>. |
TAction | The title-specific bot action that implements IEquatable<T>. |
Properties
View SourceBots
Gets the collection of bots controlled by the brain.
Declaration
IReadOnlyCollection<TBot> Bots { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<TBot> |
Methods
View SourceGetBotData(TBot)
Gets the bot data for the given bot.
Declaration
BrainBotData<TState, TBot, TAction>? GetBotData(TBot bot)
Parameters
Type | Name | Description |
---|---|---|
TBot | bot | The bot. |
Returns
Type | Description |
---|---|
BrainBotData<TState, TBot, TAction> | The bot data. |
Start(TBot, CancellationToken, params TState[])
Starts controlling the bot.
Declaration
void Start(TBot bot, CancellationToken token = default, params TState[] states)
Parameters
Type | Name | Description |
---|---|---|
TBot | bot | The bot to control. |
CancellationToken | token | A cancellation token to end the automation. |
TState[] | states | The states used to update the bot. |
Stop(TBot)
Stops controlling the bot.
Declaration
Task Stop(TBot bot)
Parameters
Type | Name | Description |
---|---|---|
TBot | bot | The bot to stop controlling. |
Returns
Type | Description |
---|---|
Task | A task that returns after stopping the bot. |
Update(TState, IReadOnlyCollection<TBot>?)
Updates the state and current action of the given bots.
Declaration
Task Update(TState state, IReadOnlyCollection<TBot>? bots = null)
Parameters
Type | Name | Description |
---|---|---|
TState | state | The game state. |
IReadOnlyCollection<TBot> | bots | The bots to update. If null, all controlled bots are updated. |
Returns
Type | Description |
---|---|
Task | A task that returns after updating each bot. |
Events
View SourceOnBotPaused
Occurs when the brain pauses a bot.
Declaration
event EventHandler<TBot>? OnBotPaused
Event Type
Type | Description |
---|---|
EventHandler<TBot> |
OnBotStopped
Occurs when the brain stops a bot.
Declaration
event EventHandler<TBot>? OnBotStopped
Event Type
Type | Description |
---|---|
EventHandler<TBot> |