private async void DoShoot(byte direction) { MainGame.ViewerAddBullet(bot.X, bot.Y, direction, 10); MoveDirection dir; try { dir = (MoveDirection)direction; } catch (Exception) { return; } int dx = 0; int dy = 0; switch (dir) { case MoveDirection.North: dy = 1; break; case MoveDirection.South: dy = -1; break; case MoveDirection.East: dx = 1; break; case MoveDirection.West: dx = -1; break; } int tx = bot.X + dx; int ty = bot.Y + dy; while (tx > 0 && tx < MainGame.Settings.MapWidth && ty > 0 && ty < MainGame.Settings.MapHeight) { if (MainGame.TheMap[tx, ty] == CaseState.Ennemy) { Console.WriteLine($"Bot {bot.Name} shoot from {bot.X}/{bot.Y}"); TouchEnemy((ushort)tx, (ushort)ty); break; } tx += dx; ty += dy; } } // DoShoot