Example #1
0
    public static LevelMap GetRandomMap()
    {
        List <string> names   = MapParser.GetMapNamesFromJSON();
        int           randNum = UnityEngine.Random.Range(0, names.Count);
        LevelMap      map     = MapParser.GetLevelMapFromJSON(names[randNum]);

        return(map);
    }
Example #2
0
 void MapChoiceDropdownListener()
 {
     mapChoiceDropdown.onValueChanged.AddListener(
         delegate {
         string dropdownText = mapChoiceDropdown.captionText.text.ToString();
         mapNameInput.text   = dropdownText;
         LevelMap.ClearMapObjects(ref mapEditor.map);
         mapEditor.map = MapParser.GetLevelMapFromJSON(dropdownText);
     });
 }
Example #3
0
    public static List <LevelMap> GetAllLevelMapsFromJSON()
    {
        List <LevelMap> levelMaps      = new List <LevelMap>();
        string          fileTextString = File.ReadAllText(FilePaths.jsonMaps);
        JsonData        jsonData       = JsonMapper.ToObject(fileTextString);

        List <string> mapNames = MapParser.GetMapNamesFromJSON();

        for (int n = 0; n < mapNames.Count; ++n)
        {
            levelMaps.Add(MapParser.GetLevelMapFromJSON(mapNames[n]));
        }
        return(levelMaps);
    }