Class BotWithEvents<TAction>
A simple implementation of a bot with events.
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain
Assembly: BotBrain.Core.dll
Syntax
public class BotWithEvents<TAction> : EventPublisher<BotActionEventArgs>, IEventPublisher<BotActionEventArgs>, IBotWithEvents<TAction>, IBotWithEvents, IAutomatedBot<TAction>, IAutomatedBot, IHasParametersType Parameters
| Name | Description | 
|---|---|
| TAction | The bot action type. | 
Properties
View SourceCurrentAction
Gets or sets the bot's current action.
Declaration
public virtual TAction CurrentAction { get; set; }Property Value
| Type | Description | 
|---|---|
| TAction | 
CurrentUrge
Gets or sets the current urge.
Declaration
public object? CurrentUrge { get; set; }Property Value
| Type | Description | 
|---|---|
| object | 
IsRunning
Gets a value indicating whether the bot is executing an action.
Declaration
public virtual bool IsRunning { get; }Property Value
| Type | Description | 
|---|---|
| bool | 
Name
Gets or sets the name of the bot.
Declaration
public string? Name { get; set; }Property Value
| Type | Description | 
|---|---|
| string | 
Parameters
Gets or sets the parameters.
Declaration
public IParameterManager Parameters { get; set; }Property Value
| Type | Description | 
|---|---|
| IParameterManager | 
Methods
View SourceOnActionFailed(TAction, Exception)
Raises an event indicating that running an action caused an error.
Declaration
protected void OnActionFailed(TAction action, Exception ex)Parameters
| Type | Name | Description | 
|---|---|---|
| TAction | action | The action that failed. | 
| Exception | ex | The exception that occurred. | 
OnActionFinished(TAction)
Raises an event indicating that the action's finished.
Declaration
protected void OnActionFinished(TAction action)Parameters
| Type | Name | Description | 
|---|---|---|
| TAction | action | The action. | 
OnActionStarted()
Raises an event indicating that the current action's started.
Declaration
protected void OnActionStarted()Reset()
Resets the bot's current action and stops the bot.
Declaration
public virtual Task Reset()Returns
| Type | Description | 
|---|---|
| Task | A task that completes once the bot is reset. | 
Start()
Starts executing the bot queue.
Declaration
public virtual Task Start()Returns
| Type | Description | 
|---|---|
| Task | A task that completes once the queue begins. | 
Stop()
Stops executing the bot queue.
Declaration
public virtual Task Stop()Returns
| Type | Description | 
|---|---|
| Task | A task that completes once the queue stops. | 
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()Returns
| Type | Description | 
|---|---|
| string | A string that represents the current object. | 
Overrides
Events
View SourceActionFailed
Occurs when a bot action has a failure.
Declaration
public event EventHandler<BotActionFailedEventArgs>? ActionFailedEvent Type
| Type | Description | 
|---|---|
| EventHandler<BotActionFailedEventArgs> | 
ActionFinished
Occurs when the bot finishes an action.
Declaration
public event EventHandler<BotActionEventArgs>? ActionFinishedEvent Type
| Type | Description | 
|---|---|
| EventHandler<BotActionEventArgs> | 
ActionStarted
Occurs when the bot starts an action.
Declaration
public event EventHandler<BotActionEventArgs>? ActionStartedEvent Type
| Type | Description | 
|---|---|
| EventHandler<BotActionEventArgs> |