public void PlaySoundByIndex(int indexNumber, Vector3 position) { if (indexNumber > _soundObjectList.Count) { indexNumber = _soundObjectList.Count - 1; } _tempSoundObject = _soundObjectList[indexNumber]; _tempSoundObject.PlaySound(position); }
private void Start() { Volume = PlayerPrefs.GetFloat(GamePrefsName + "_SFXVol", Volume); _soundObjectList = new List <SoundObject>(); foreach (var theSound in GameSounds) { _tempSoundObject = new SoundObject(theSound, theSound.name, Volume); _soundObjectList.Add(_tempSoundObject); } }