Show / Hide Table of Contents

Interface IBrainUpdater

An interface used to run bot brains.

Namespace: Microsoft.XboxStudios.BotBrain.Composition
Assembly: BotBrain.Abstractions.dll
Syntax
public interface IBrainUpdater

Properties

View Source

Bots

Gets the collection of bots to update.

Declaration
IReadOnlyCollection<IAutomatedBot> Bots { get; }
Property Value
Type Description
IReadOnlyCollection<IAutomatedBot>
View Source

Brain

Gets the default brain to use.

Declaration
IBotBrain? Brain { get; }
Property Value
Type Description
IBotBrain
View Source

Brains

Gets the collection of bot brains to update.

Declaration
IReadOnlyCollection<IBotBrain> Brains { get; }
Property Value
Type Description
IReadOnlyCollection<IBotBrain>
View Source

TickFrequency

Gets or sets the update frequency.

Declaration
TimeSpan TickFrequency { get; set; }
Property Value
Type Description
TimeSpan

Methods

View Source

AddBotAsync(string, IBotBrain?, string?, int, CancellationToken)

Adds a bot to the brain.

Declaration
Task<IAutomatedBot?> AddBotAsync(string deviceName, IBotBrain? brain = null, string? botName = null, int playerIndex = 0, CancellationToken token = default)
Parameters
Type Name Description
string deviceName

The device name or connection string.

IBotBrain brain

The brain to use.

string botName

The bot's name.

int playerIndex

The bot's player index.

CancellationToken token

The cancellation token.

Returns
Type Description
Task<IAutomatedBot>

The bot.

View Source

AddBotAsync(string, object, IBotBrain?, string?, int, CancellationToken)

Adds a bot to the brain.

Declaration
Task<IAutomatedBot> AddBotAsync(string deviceName, object state, IBotBrain? brain = null, string? botName = null, int playerIndex = 0, CancellationToken token = default)
Parameters
Type Name Description
string deviceName

The device name.

object state

The game state.

IBotBrain brain

The brain to use.

string botName

The bot's name.

int playerIndex

The bot's player index.

CancellationToken token

The cancellation token.

Returns
Type Description
Task<IAutomatedBot>

The bot.

View Source

AddBrain(IBotBrain?)

Adds a brain instance.

Declaration
bool AddBrain(IBotBrain? brain)
Parameters
Type Name Description
IBotBrain brain

The brain.

Returns
Type Description
bool

True if the brain was added successfully.

View Source

AddBrain(string)

Loads a brain file and adds the instance.

Declaration
bool AddBrain(string name)
Parameters
Type Name Description
string name

The name of the brain.

Returns
Type Description
bool

True if the brain was loaded and added.

View Source

ClearBrains()

Removes all brain instances.

Declaration
void ClearBrains()
View Source

RemoveBotAsync(IAutomatedBot, IBotBrain?)

Removes a bot from the brain.

Declaration
Task RemoveBotAsync(IAutomatedBot bot, IBotBrain? brain = null)
Parameters
Type Name Description
IAutomatedBot bot

The bot.

IBotBrain brain

The brain to use.

Returns
Type Description
Task

A task.

View Source

RemoveBrain(IBotBrain)

Removes a brain.

Declaration
void RemoveBrain(IBotBrain brain)
Parameters
Type Name Description
IBotBrain brain

The brain.

View Source

Run(CancellationToken)

Runs each brain.

Declaration
Task Run(CancellationToken token = default)
Parameters
Type Name Description
CancellationToken token

The cancellation token.

Returns
Type Description
Task

A task which completes when the brains are stopped.

View Source

RunOnce()

Runs each brain once, if it is not currently updating.

Declaration
void RunOnce()
Remarks

This completes as soon as the brains are started.

View Source

SetBrain(IBotBrain)

Removes all brain instances, and then adds the given brain instance.

Declaration
bool SetBrain(IBotBrain brain)
Parameters
Type Name Description
IBotBrain brain

The brain.

Returns
Type Description
bool

True if the brain was added successfully.

View Source

SetBrain(string)

Removes all brain instances, and then loads a brain file and adds the instance.

Declaration
bool SetBrain(string name)
Parameters
Type Name Description
string name

The name of the brain.

Returns
Type Description
bool

True if the brain was loaded and added.

  • View Source
In this article
Back to top Generated by DocFX