Exemplo n.º 1
0
    protected static void UpdateBundles(Config[] configs)
    {
        var bundleMap = new BundleMap();

        for (int i = 0; i < configs.Length; i++)
        {
            var raceName = configs[i].folderName;

            var raceMap = new RaceMap();
            raceMap.race       = raceName;
            raceMap.configPath = ParseConfigPath(configs[i]);
            raceMap.prefabPath = ParsePrefabPath(configs[i]);
            raceMap.textures   = ParseBundleTextures(raceName);
            raceMap.meshes     = ParseBundleMeshes(raceName);
            raceMap.fxs        = ParseBundleFXMeshes(raceName);

            bundleMap.races.Add(raceMap);
        }

        if (!Directory.Exists(Application.dataPath + "/Resources/"))
        {
            Directory.CreateDirectory(Application.dataPath + "/Resources/");
        }

        using (FileStream fs = new FileStream("Assets/Resources/assetBundleInfo.json", FileMode.Create))
        {
            using (StreamWriter writer = new StreamWriter(fs))
            {
                writer.Write(JsonUtility.ToJson(bundleMap));
            }
        }
        AssetDatabase.Refresh();
    }
Exemplo n.º 2
0
        private void StartRace(string mapName)
        {
            RaceMap map = new RaceMap(mapName);

            map.Start();

            this.race = map.GetRace();
            for (int i = players.Count - 1; i >= 0; i--)
            {
                AddPlayerToRace(players[i], race);
            }
            StartRace(race);
        }