public async Task CreateGame(String mapName, Race opponentRace, Difficulty opponentDifficulty, AIBuild aIBuild) { var createGame = new RequestCreateGame(); createGame.Realtime = false; string mapPath = Path.Combine(starcraftDir, "Maps", mapName); if (!File.Exists(mapPath)) { throw new Exception("Could not find map at " + mapPath); } createGame.LocalMap = new LocalMap(); createGame.LocalMap.MapPath = mapPath; var player1 = new PlayerSetup(); createGame.PlayerSetup.Add(player1); player1.Type = PlayerType.Participant; var player2 = new PlayerSetup(); createGame.PlayerSetup.Add(player2); player2.Race = opponentRace; player2.Type = PlayerType.Computer; player2.Difficulty = opponentDifficulty; player2.AiBuild = aIBuild; var request = new Request(); request.CreateGame = createGame; var response = await Proxy.SendRequest(request); }
public async Task RunSinglePlayer(ISharkyBot bot, string map, Race myRace, Race opponentRace, Difficulty opponentDifficulty, AIBuild aIBuild) { readSettings(); StartSC2Instance(5678); await Connect(5678); await CreateGame(map, opponentRace, opponentDifficulty, aIBuild); var playerId = await JoinGame(myRace); await Run(bot, playerId, "test"); }