override protected void OnStartGameCompleted(StartGameRequest.ResultData result) { _levelConfig = result.levelConfig; CreateGoals(result.gameGoals.Count); CopyGoals(result.gameGoals); _moves = 1; _validMoves = 1; _maxMoves = result.levelConfig.moves; LIMIT = _maxMoves * 10; Vector.Release(_state0); _state0 = _encoder.EncodeState(result.gridData, 0, _agent.GetParam(BaseAgent.STATE_DIM), boost); _gameState.grid = result.gridData; _gameState.goals = result.gameGoals; _gameState.randomHistory = null; _gameState.powerupScore = 0; _gameState.levelScore = 0; boost = false; /* * _gridCheck = 0; * GridCheck(); */ waitingForInterface = false; }
public void PrepareEncoderProjection(Match3LevelConfig p_config) { int cellId = 0; int itemId = 0; _itemProjection = new Dictionary <string, int>(); _cellProjection = new Dictionary <string, int>(); foreach (Match3LevelConfig.Match3LevelCell cell in p_config.cells) { if (!_cellProjection.ContainsKey(cell.cellTypeID)) { _cellProjection.Add(cell.cellTypeID, cellId); cellId++; } if (!_itemProjection.ContainsKey(cell.itemID)) { _itemProjection.Add(cell.itemID, itemId); itemId++; } } foreach (Match3LevelConfig.Match3LevelDrop drop in p_config.drops) { if (!_itemProjection.ContainsKey(drop.itemID)) { _itemProjection.Add(drop.itemID, itemId); itemId++; } } foreach (Match3LevelConfig.Match3LevelSpawn spawn in p_config.spawns) { if (!_itemProjection.ContainsKey(spawn.itemID)) { _itemProjection.Add(spawn.itemID, itemId); itemId++; } } foreach (ItemType item in _inputInterface.gridDefinition.ItemTypes) { if (!_itemProjection.ContainsKey(item.Id) && item.Type == "SPECIAL") { _itemProjection.Add(item.Id, itemId); itemId++; } } }