public void FromCommandData(CommandData commandData, IBotCommands botCommands) { switch (commandData.kind) { case CommandKind.Move: botCommands.Move((Direction)(Int64)commandData.parameters[0], (uint)(Int64)commandData.parameters[1]); break; case CommandKind.MoveDirection: botCommands.MoveDirection((Direction)(Int64)commandData.parameters[0]); break; case CommandKind.MoveShotRotation: botCommands.MoveShotRotation((float)(double)commandData.parameters[0]); break; case CommandKind.Shot: botCommands.Shot(); break; case CommandKind.MeleeAttack: botCommands.MeleeAttack(); break; default: throw new ArgumentOutOfRangeException(); } }
public async void Start(IBotCommands botCommands) { while (true) { var direction = (Direction)Random.Range(0, 4); var addvec = new Vector2[] { Vector2.up, Vector2.down, Vector2.left, Vector2.right }[(int)direction]; var myPosition = await botCommands.GetMyPosition(); var tileType = await botCommands.GetTileType(new GridPosition((int)(myPosition.X + addvec.x), (int)(myPosition.Y + addvec.y))); if (tileType != TileType.Hole) { await botCommands.Move(direction, 1); } if (Random.Range(0, 100) == 50) { botCommands.Shot(); await botCommands.MoveShotRotation(Random.Range(0, 360)); } } }
public RegistroPontoBot(string token, string webHookUrl, IBotApiService apiService, IBotCommands comandos) { _apiService = apiService; _comandos = comandos; Token = token; WebHookUrl = webHookUrl; }
public void Setup() { kernel.Reset(); kernel.Unbind <RegistroPontoBot>(); token = "666"; webHookAdress = "teste.com/webhook"; kernel.Bind <RegistroPontoBot>().ToSelf() .WithConstructorArgument("token", token) .WithConstructorArgument("webHookUrl", webHookAdress); botCommands = kernel.Get <IBotCommands>(); _sut = kernel.Get <RegistroPontoBot>(); apiService = kernel.Get <IBotApiService>(); }
public void Setup() { kernel.Reset(); kernel.Unbind<RegistroPontoBot>(); token = "666"; webHookAdress = "teste.com/webhook"; kernel.Bind<RegistroPontoBot>().ToSelf() .WithConstructorArgument("token", token) .WithConstructorArgument("webHookUrl", webHookAdress); botCommands = kernel.Get<IBotCommands>(); _sut = kernel.Get<RegistroPontoBot>(); apiService = kernel.Get<IBotApiService>(); }
public ClientBotCommandsHook(IBotCommands botCommands, GameSignalingClient gameSignalingClient) { this.botCommands = botCommands; this.gameSignalingClient = gameSignalingClient; gameSignalingClient.ReceivedClientReceiveSignalData += data => { if (data.commandApplyTarget == MatchType.Host) { return; } if (semaphores.TryRemove(data.commandData.id, out var semaphore)) { semaphore.Release(); } }; }
public JavaScriptEngine(IBotCommands botCommands) { this.botCommands = botCommands; }
public HostBotCommandsHook(IBotCommands botCommands, GameSignalingHost gameSignalingHost) { this.botCommands = botCommands; this.gameSignalingHost = gameSignalingHost; }