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
    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);
    }
Example #3
0
    //TOP GUI************************************
    void InitMapChoiceItems()
    {
        List <string> mapNames = MapParser.GetMapNamesFromJSON();

        mapChoiceDropdown.options.Clear();
        foreach (string name in mapNames)
        {
            mapChoiceDropdown.options.Add(new Dropdown.OptionData()
            {
                text = name.ToString()
            });
        }
        mapChoiceDropdown.value = 1;
        mapChoiceDropdown.value = 0;
    }