// Use this for initialization void Start() { Debug.Log(InitialMap); JSONDecoder.DecodeMap(InitialMap, Map.Current, out HeroSpawns, out MonsterSpawns, out ObjectiveSpawns); SetupSpawnArray(); SpawnObjectiveObjects(); Map.Current.LockAllTiles(); foreach (Tile t in MonsterSpawns) { t.Locked = false; t.HighlightColor = ValidTileHightlightColor; t.Highlighted = true; } foreach (Tile t in ObjectiveSpawns) { t.HighlightOverrideLock = true; t.Highlighted = true; t.HighlightColor = Color.yellow; } foreach (Tile t in HeroSpawns) { t.HighlightOverrideLock = true; t.Highlighted = true; t.HighlightColor = Color.red; } }
void Start() { if (GameManager.instance != null && MatchState != null) { if (instance != null) { Debug.LogError("Something went wrong in match singleton creation"); Destroy(this); return; } else { MatchManager.instance = this; } queuedPackets = new Dictionary <int, JSONObject>(); socket = GameManager.instance.getSocket(); MatchIdentifier = MatchState.GetField("match_identifier").str; HeroPlayer = MatchState.GetField("players").GetField("heroes").str; ArchitectPlayer = MatchState.GetField("players").GetField("architect").str; UpdatePlayers(MatchState); string gstate = MatchState["game_state"].str; if ("hero_turn".Equals(gstate)) { gameState = GameState.HeroTurn; } else if ("architect_turn".Equals(gstate)) { gameState = GameState.ArchitectTurn; } TurnNumber = (int)MatchState["turn_number"].n; RegisterJSONChangeAction("/turn_number", UpdateTurn); RegisterJSONChangeAction("/game_state", UpdateGameState); JSONDecoder.DecodeMap(MatchState.GetField("map"), Map.Current); JSONDecoder.DecodeMapObjects(MatchState.GetField("board_objects"), manager); socket.On("game_update", GameUpdate); } else { Debug.LogError("You got in here without a game manager or match start data! How did you do that!"); Destroy(this.gameObject); } }