protected AgentAction AddBindableAction(IAsyncExecutableAction action) { var agentAction = new AgentAction(this, action); _actions.Add(agentAction); return(agentAction); }
private async Task ExecuteAction(IAsyncExecutableAction action, DomainState currentState, CancellationToken token) { OnActionStarting(action); CurrentAction = action; try { var actionSucceeded = await action.ExecuteAsync(currentState, token); if (actionSucceeded) { OnActionCompleted(action); } else { OnActionFailed(action); } } catch (OperationCanceledException) { CurrentAction = null; } }
public AgentAction(Agent agent, IAsyncExecutableAction action) { _action = action; _agent = agent; }