/// <summary> /// Event called by the bot runner when a bot's state changes. /// </summary> /// <param name="bot"></param> /// <param name="newState"></param> private void BotRunner_OnBotStateChange(VTankBot bot, AIFramework.Runner.BotRunner.BotRunnerState newState) { if (newState != BotRunner.BotRunnerState.SelectingTank && OnBotChange != null) { buffer.Enqueue(new Invocation.InvocationTarget((o) => { OnBotChange((VTankBot)o); }), bot); NeedsBalance = true; } buffer.Enqueue(new Invocation((o) => { Print("{0}'s state: {1}", bot.AuthInfo.Username, newState.ToString()); })); }
public BotManager(BotRunner runner) { buffer = new InvocationBuffer(); reservedList = new List <VTankBot>(); BotRunner = runner; WaitTimeReconnect = 5000; BotRunner.OnCrash += new BotRunner.Disconnect((bot) => { buffer.Enqueue(new Invocation.InvocationTarget(HandleCrash), bot, WaitTimeReconnect); }); BotRunner.OnBotStateChange += new BotRunner.BotStateChange(BotRunner_OnBotStateChange); needsBalance = false; }
public BotManager(BotRunner runner) { buffer = new InvocationBuffer(); reservedList = new List<VTankBot>(); BotRunner = runner; WaitTimeReconnect = 5000; BotRunner.OnCrash += new BotRunner.Disconnect((bot) => { buffer.Enqueue(new Invocation.InvocationTarget(HandleCrash), bot, WaitTimeReconnect); }); BotRunner.OnBotStateChange += new BotRunner.BotStateChange(BotRunner_OnBotStateChange); needsBalance = false; }