Ejemplo n.º 1
0
    IEnumerator loadData()
    {
        // loadingText += "Loading Default Physics... ";
        // Wadfile physicsFile = new Wadfile();
        loadingText += "\n";
        SoundsFile sounds = new SoundsFile();

        sounds.Load(GlobalData.soundsFilePath);
        yield return(makeAudioDefinitionsFromSoundsFile(sounds));

        // AudioSource aud = GetComponent<AudioSource>();
        // aud.clip = audioDefinitions[29].sounds[0];
        // aud.Play();

        loadingText   += "\n";
        GlobalData.map = this;
        ShapesFile shapes = new ShapesFile();

        shapes.Load(GlobalData.shapesFilePath);
        yield return(StartCoroutine(makeMaterialsFromShapesFile(shapes)));

        loadingText += "\nLoading Map... ";
        Wadfile wadfile = new Wadfile();

        wadfile.Load(GlobalData.mapsFilePath);
        foreach (var kvp in wadfile.Directory)
        {
            if (kvp.Value.Chunks.ContainsKey(MapInfo.Tag))
            {
                string String      = kvp.Value.LevelName;
                int    levelNumber = kvp.Key;
            }
        }
        Level Level = new Level();

        Level.Load(wadfile.Directory[mapNo]);

        Debug.Log(Level.Name);
        // Debug.Log(Level.Environment);

        yield return(createLightsFromMarathonMap(Level));

        yield return(StartCoroutine(makeWorldFromMarathonMap(Level)));

        loadingText += "\nSpawing Entities... ";
        yield return(StartCoroutine(spawnEntitiesFromMarathonMap(Level, shapes)));

        loadingText = null;
        GameObject.Find("LoadingDisplay").SetActive(false);


        GameObject.Find("worldLight").SetActive(GlobalData.globalLighting);
    }
Ejemplo n.º 2
0
        public static void Initialize()
        {
            SoundsFile soundFile = new SoundsFile(GameVars.BasePath + "sound\\sound.txt");

            _soundDescriptions = soundFile.Sounds;
            IsInitialized      = true;

            if (!_enabled)
            {
                return;
            }

            //foreach (SoundDesc desc in _soundDescriptions)
            //    CreateInstance(desc.Id, true);

            CreateInstance(5000, true);
            CreateInstance(5001, true);
            CreateInstance(5002, true);
            CreateInstance(5003, true);
            CreateInstance(5004, true);
        }
Ejemplo n.º 3
0
    IEnumerator makeAudioDefinitionsFromSoundsFile(SoundsFile sounds)
    {
        //Debug.Log(sounds.SourceCount);
        string load = loadingText;

        for (int sound = 0; sound < sounds.SoundCount; sound++)
        {
            SoundDefinition sd = sounds.GetSound(1, sound);
            audioDefinition ad = new audioDefinition();
            ad.sounds = new List <AudioClip>();
            foreach (Permutation p in sd.permutations)
            {
                AudioClip clip = AudioClip.Create("sound", p.Samples.Length, 1, (int)p.SampleRate, false);
                clip.SetData(p.Samples, 0);
                ad.sounds.Add(clip);
            }
            ad.cannotBeMediaObstructed = sd.CannotBeMediaObstructed;
            ad.cannotBeRestarted       = sd.CannotBeRestarted;
            ad.doesNotSelfAbort        = sd.DoesNotSelfAbort;
            ad.resistsPitchChanges     = sd.ResistsPitchChanges;
            ad.cannotChangePitch       = sd.CannotChangePitch;
            ad.cannotBeObstructed      = sd.CannotBeObstructed;
            ad.isAmbient = sd.IsAmbient;
            ad.chance    = sd.Chance;
            ad.lowPitch  = sd.LowPitch;
            ad.highPitch = sd.HighPitch;

            audioDefinitions.Add(ad);

            if (sound % 77 == 0)
            {
                loadingText = load + "Loading Sounds... " + sound + "/" + sounds.SoundCount;
                yield return(null);
            }
        }
        loadingText = load + "Loading Sounds... " + sounds.SoundCount + "/" + sounds.SoundCount;
    }