/// <summary> /// Adds action audio. /// </summary> private static void AddActionAudioSource(GameObject go, uint id) { if (id > 0) { DaggerfallAudioSource c = go.AddComponent <DaggerfallAudioSource>(); c.SetSound(id); } }
private static void AddHorseAudioSource(GameObject go) { DaggerfallAudioSource c = go.AddComponent <DaggerfallAudioSource>(); c.AudioSource.dopplerLevel = 0; c.AudioSource.rolloffMode = AudioRolloffMode.Linear; c.AudioSource.maxDistance = 5f; c.AudioSource.volume = 0.7f; c.SetSound(SoundClips.AnimalHorse, AudioPresets.PlayRandomlyIfPlayerNear); }
private static void AddTorchAudioSource(GameObject go) { DaggerfallAudioSource c = go.AddComponent <DaggerfallAudioSource>(); c.AudioSource.dopplerLevel = 0; c.AudioSource.rolloffMode = AudioRolloffMode.Linear; c.AudioSource.maxDistance = 5f; c.AudioSource.volume = 0.7f; c.SetSound(SoundClips.Burning, AudioPresets.LoopIfPlayerNear); }
private static void AddTorchAudioSource(GameObject go) { // Apply looping burning sound to flaming torches and fires // Set to linear rolloff or the burning sound is audible almost everywhere DaggerfallAudioSource c = go.AddComponent <DaggerfallAudioSource>(); c.AudioSource.dopplerLevel = 0; c.AudioSource.rolloffMode = AudioRolloffMode.Linear; c.AudioSource.maxDistance = torchMaxDistance; c.AudioSource.volume = torchVolume; c.SetSound(SoundClips.Burning, AudioPresets.LoopIfPlayerNear); }
private void ApplyPresets() { if (Presets == AmbientSoundPresets.Dungeon) { // Set dungeon one-shots ambientSounds = new SoundClips[] { SoundClips.AmbientDripShort, SoundClips.AmbientDripLong, SoundClips.AmbientWindMoan, SoundClips.AmbientWindMoanDeep, SoundClips.AmbientDoorOpen, SoundClips.AmbientGrind, SoundClips.AmbientStrumming, SoundClips.AmbientWindBlow1, SoundClips.AmbientWindBlow1a, SoundClips.AmbientWindBlow1b, SoundClips.AmbientMonsterRoar, SoundClips.AmbientGoldPieces, SoundClips.AmbientBirdCall, SoundClips.AmbientDoorClose, }; } else if (Presets == AmbientSoundPresets.Storm) { // Set storm one-shots ambientSounds = new SoundClips[] { SoundClips.StormLightningShort, SoundClips.StormLightningThunder, SoundClips.StormThunderRoll, }; } else if (Presets == AmbientSoundPresets.SunnyDay) { ambientSounds = new SoundClips[] { SoundClips.BirdCall1, SoundClips.BirdCall2, }; } else { ambientSounds = null; } lastPresets = Presets; dfAudioSource.SetSound(-1, AudioPresets.OnDemand, 0); }
private static void AddAnimalAudioSource(GameObject go) { DaggerfallAudioSource source = go.AddComponent <DaggerfallAudioSource>(); source.AudioSource.maxDistance = animalSoundMaxDistance; DaggerfallBillboard dfBillboard = go.GetComponent <DaggerfallBillboard>(); SoundClips sound = SoundClips.None; switch (dfBillboard.Summary.Record) { case 0: case 1: sound = SoundClips.AnimalHorse; break; case 3: case 4: sound = SoundClips.AnimalCow; break; case 5: case 6: sound = SoundClips.AnimalPig; break; case 7: case 8: sound = SoundClips.AnimalCat; break; case 9: case 10: sound = SoundClips.AnimalDog; break; default: sound = SoundClips.None; break; } source.SetSound(sound, AudioPresets.PlayRandomlyIfPlayerNear); }
private void ApplyPresets() { if (Presets == AmbientSoundPresets.Dungeon) { // Set dungeon one-shots ambientSounds = new SoundClips[] { SoundClips.AmbientDripShort, SoundClips.AmbientDripLong, SoundClips.AmbientWindMoan, SoundClips.AmbientWindMoanDeep, SoundClips.AmbientDoorOpen, SoundClips.AmbientGrind, SoundClips.AmbientStrumming, SoundClips.AmbientWindBlow1, SoundClips.AmbientWindBlow2, SoundClips.AmbientMetalJangleLow, SoundClips.AmbientBirdCall, SoundClips.AmbientSqueaks, SoundClips.AmbientClank, SoundClips.AmbientDistantMoan, }; } else if (Presets == AmbientSoundPresets.Storm) { // Set storm one-shots ambientSounds = new SoundClips[] { SoundClips.StormLightningShort, SoundClips.StormLightningThunder, SoundClips.StormThunderRoll, }; } else { ambientSounds = null; } lastPresets = Presets; dfAudioSource.SetSound(0, AudioPresets.OnDemand, false); }
private void Setup() { currentLocationName = playerEnterExit.Dungeon.Summary.LocationName; DaggerfallActionDoor[] actionDoors = FindObjectsOfType <DaggerfallActionDoor>(); if (actionDoors != null) { for (int i = 0; i < actionDoors.Length; i++) { string meshFilterName = actionDoors[i].GetComponent <MeshFilter>().name; if (meshFilterName.Contains("55000") || meshFilterName.Contains("55001") || meshFilterName.Contains("55002") || meshFilterName.Contains("55003") || meshFilterName.Contains("55004") || meshFilterName.Contains("55005")) { // Normal door continue; } else { // Secret door GameObject gameObject = new GameObject("SecretDoorAudio"); gameObject.transform.position = actionDoors[i].transform.position; gameObject.transform.SetParent(actionDoors[i].transform); gameObject.AddComponent <DaggerfallAudioSource>(); DaggerfallAudioSource daggerfallAudioSource = gameObject.GetComponent <DaggerfallAudioSource>(); daggerfallAudioSource.SetSound(72, AudioPresets.LoopIfPlayerNear); daggerfallAudioSource.AudioSource.rolloffMode = AudioRolloffMode.Linear; daggerfallAudioSource.AudioSource.minDistance = minDist; daggerfallAudioSource.AudioSource.maxDistance = maxDist; daggerfallAudioSource.AudioSource.volume = volume; } } } }