public override SoundInstance TestInEditor(ISoundPool soundPool) { AmbienceSoundInstance sound = Fetch(soundPool); if (sound != null) { if (_audioListener == null) { _audioListener = FindObjectOfType <AudioListener>(); } if (_audioListener != null) { sound.Play3D(_audioListener.transform.position); } else { sound.Play2D(); } OnPlayed(sound); return(sound); } return(null); }
public BlendSoundInstance Fetch(ISoundPool soundPool) { if (!IsPlayable()) { return(null); } BlendSoundInstance sound = soundPool.FetchFromPool <BlendSoundInstance>(); sound.name = name; for (int i = 0; i < _layers.Length; i++) { if (!_layers[i].Sound.IsEmpty) { sound.AddLayer(_layers[i]); } } if (_outputMixer != null) { sound.SetMixerGroup(_outputMixer); } AddFilters(sound); return(sound); }
public SequenceSoundInstance Fetch(ISoundPool soundPool) { if (!IsPlayable()) { return(null); } SequenceSoundInstance sound = soundPool.FetchFromPool <SequenceSoundInstance>(); sound.name = name; for (int i = 0; i < _sections.Length; i++) { if (!_sections[i].Sound.IsEmpty) { sound.AddSection(_sections[i]); } } if (_outputMixer != null) { sound.SetMixerGroup(_outputMixer); } AddFilters(sound); return(sound); }
public PlayableHitsound(MapAssetStore assetStore, SampleControlPoint samplePoint, List <SoundInfo> samples, ISoundPool soundPool) { this.soundTable = assetStore.SoundTable; this.soundPool = soundPool; hitsoundAudio.AddRange(ExtractAudio(assetStore, samples)); volume = samplePoint.Volume; }
public override SoundInstance TestInEditor(ISoundPool soundPool) { BlendSoundInstance sound = Fetch(soundPool); if (sound != null) { sound.Play2D(); OnPlayed(sound); return(sound); } return(null); }
public override SoundInstance TestInEditor(ISoundPool soundPool) { EffectSoundInstance sound = Fetch(soundPool); if (sound != null && (_cooldown <= 0 || TimeSinceLastPlayed > _cooldown)) { sound.Play2D(); OnPlayed(sound); return(sound); } return(null); }
public override SoundInstance TestInEditor(ISoundPool soundPool) { ImpactSoundInstance sound = Fetch(soundPool, _velocityRange.ChooseRandom()); if (sound != null && (_cooldown <= 0 || TimeSinceLastPlayed > _cooldown)) { sound.Play2D(); OnPlayed(sound); return(sound); } return(null); }
public EffectSoundInstance Fetch(ISoundPool soundPool) { EffectSoundInstance sound = soundPool.FetchFromPool <EffectSoundInstance>(); sound.name = name; sound.SetClip(GetNextClip()); sound.SetRolloffDistance(_rolloffDistance.Min, _rolloffDistance.Max); sound.SetMixerGroup(_outputMixer); sound.SetBaseVolume(_volumeRange.ChooseRandom()); sound.SetBasePitch(_pitchRange.ChooseRandom()); AddFilters(sound); return(sound); }
public ImpactSoundInstance Fetch(ISoundPool soundPool, float impactVelocity) { ImpactSoundInstance sound = soundPool.FetchFromPool <ImpactSoundInstance>(); sound.name = name; sound.SetClip(GetNextClip()); sound.SetImpactVelocity(impactVelocity); sound.SetVelocityRange(_velocityRange.Min, _velocityRange.Max); sound.SetRolloffDistance(_rolloffDistance.Min, _rolloffDistance.Max); sound.SetMixerGroup(_outputMixer); sound.SetBaseVolume(_volumeRange.ChooseRandom()); sound.SetBasePitch(_pitchRange.ChooseRandom()); AddFilters(sound); return(sound); }
public SoundInstance Fetch(ISoundPool pool) { if (IsEmpty) { return(null); } if (_isBank) { Type type = _soundBank.GetType(); if (type == typeof(AmbienceSoundBank)) { return((_soundBank as AmbienceSoundBank).Fetch(pool)); } if (type == typeof(BlendSoundBank)) { return((_soundBank as BlendSoundBank).Fetch(pool)); } if (type == typeof(EffectSoundBank)) { return((_soundBank as EffectSoundBank).Fetch(pool)); } if (type == typeof(ImpactSoundBank)) { return((_soundBank as ImpactSoundBank).Fetch(pool, 0f)); } if (type == typeof(SequenceSoundBank)) { return((_soundBank as SequenceSoundBank).Fetch(pool)); } throw new NotImplementedException("SoundBank type not implemented: " + type); } EffectSoundInstance sound = pool.FetchFromPool <EffectSoundInstance>(); sound.SetClip(_audioClip); return(sound); }
public AmbienceSoundInstance Fetch(ISoundPool soundPool) { if (!IsPlayable()) { return(null); } AmbienceSoundInstance sound = soundPool.FetchFromPool <AmbienceSoundInstance>(); sound.name = name; for (int i = 0; i < _effects.Length; i++) { if (!_effects[i].Sound.IsEmpty) { sound.AddEffect(_effects[i]); } } for (int i = 0; i < _loops.Length; i++) { if (!_loops[i].Sound.IsEmpty) { sound.AddLoop(_loops[i]); } } if (_outputMixer != null) { sound.SetMixerGroup(_outputMixer); } AddFilters(sound); return(sound); }
public abstract SoundInstance TestInEditor(ISoundPool soundPool);