Show / Hide Table of Contents

Class BotWithEvents<TAction>

A simple implementation of a bot with events.

Inheritance
object
EventPublisher<BotActionEventArgs>
BotWithEvents<TAction>
AutomatedBotBase<TAction>
FakeBot<T>
Implements
IEventPublisher<BotActionEventArgs>
IBotWithEvents<TAction>
IBotWithEvents
IAutomatedBot<TAction>
IAutomatedBot
IHasParameters
Inherited Members
EventPublisher<BotActionEventArgs>.Publish(object, BotActionEventArgs)
EventPublisher<BotActionEventArgs>.EventReceived
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Microsoft.XboxStudios.BotBrain
Assembly: BotBrain.Core.dll
Syntax
public class BotWithEvents<TAction> : EventPublisher<BotActionEventArgs>, IEventPublisher<BotActionEventArgs>, IBotWithEvents<TAction>, IBotWithEvents, IAutomatedBot<TAction>, IAutomatedBot, IHasParameters
Type Parameters
Name Description
TAction

The bot action type.

Properties

View Source

CurrentAction

Gets or sets the bot's current action.

Declaration
public virtual TAction CurrentAction { get; set; }
Property Value
Type Description
TAction
View Source

CurrentUrge

Gets or sets the current urge.

Declaration
public object? CurrentUrge { get; set; }
Property Value
Type Description
object
View Source

IsRunning

Gets a value indicating whether the bot is executing an action.

Declaration
public virtual bool IsRunning { get; }
Property Value
Type Description
bool
View Source

Name

Gets or sets the name of the bot.

Declaration
public string? Name { get; set; }
Property Value
Type Description
string
View Source

Parameters

Gets or sets the parameters.

Declaration
public IParameterManager Parameters { get; set; }
Property Value
Type Description
IParameterManager

Methods

View Source

OnActionFailed(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.

View Source

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.

View Source

OnActionStarted()

Raises an event indicating that the current action's started.

Declaration
protected void OnActionStarted()
View Source

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.

View Source

Start()

Starts executing the bot queue.

Declaration
public virtual Task Start()
Returns
Type Description
Task

A task that completes once the queue begins.

View Source

Stop()

Stops executing the bot queue.

Declaration
public virtual Task Stop()
Returns
Type Description
Task

A task that completes once the queue stops.

View Source

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
object.ToString()

Events

View Source

ActionFailed

Occurs when a bot action has a failure.

Declaration
public event EventHandler<BotActionFailedEventArgs>? ActionFailed
Event Type
Type Description
EventHandler<BotActionFailedEventArgs>
View Source

ActionFinished

Occurs when the bot finishes an action.

Declaration
public event EventHandler<BotActionEventArgs>? ActionFinished
Event Type
Type Description
EventHandler<BotActionEventArgs>
View Source

ActionStarted

Occurs when the bot starts an action.

Declaration
public event EventHandler<BotActionEventArgs>? ActionStarted
Event Type
Type Description
EventHandler<BotActionEventArgs>

Implements

Microsoft.XboxStudios.GameStateTracker.Events.IEventPublisher<T>
IBotWithEvents<TAction>
IBotWithEvents
IAutomatedBot<TAction>
IAutomatedBot
IHasParameters

Extension Methods

IBotWithEventsExtensions.WaitForActionFinished(IBotWithEvents, Func<Task>?, CancellationToken)
IBotWithEventsExtensions.RunAction<T>(IBotWithEvents<T>, T, CancellationToken)
IEventPublisherExtensions.WaitForAsync<T>(IEventPublisher<T>, Func<T, bool>?, CancellationToken)
  • View Source
In this article
Back to top Generated by DocFX