// Get initial game state. Input specifies world size and map generation algorithm. public async Task <GameStateResponse> SendAsync(GameStateRequest req) { var unit = new Unit { Id = 0, Pos = new Vector(req.Size / 2, req.Size / 2) }; var tiles = new Tile[req.Size, req.Size]; if (req.MapType == MapType.HalfWaterHalfLand) { for (var j = 0; j < req.Size; j++) { for (var i = 0; i < req.Size; i++) { tiles[i, j] = i > req.Size / 2 ? Tile.Water : Tile.Ground; } } } var game = new GameState(tiles, new [] { unit }); UnityEngine.Debug.Log(game.AsciiVisualization()); return(new GameStateResponse { IsSuccess = true, GameState = game }); }
//TODO: clean up the models here public async Task <GameStateReply> CreateNewGameState(GameStateRequest request) { return(await _client.CreateNewGameStateAsync(request)); }
public IActionResult CheckGameStatus([FromBody] GameStateRequest gameStateRequest) { GameResult result = Functions.GetGameResult(gameStateRequest.Gameboard); return(Json(result)); }
public JsonResult CheckGameStatus([FromBody] GameStateRequest gameStateRequest) { GameResult result = Functions.GameFunctions.GetGameResult(gameStateRequest.Playground); return(Json(result)); }