public void DrawLocalSounds(AmbientSource targ) { if (targ.localSounds == null) { targ.localSounds = new List<string>(); } for(int i = 0; i < targ.localSounds.Count; i++) { if (targ.localSounds[i] == "Delete") { GUI.FocusControl(""); //Remove it and set our index back by one. targ.localSounds.RemoveAt(i); i--; } else { targ.localSounds[i] = EditorGUILayout.TextField("Name", targ.localSounds[i]); } } EditorGUILayout.BeginHorizontal(); holdName = EditorGUILayout.TextField(holdName); if (GUILayout.Button("Add Local Sound")) { targ.localSounds.Add(holdName); } EditorGUILayout.EndHorizontal(); }
void ConvergeVolume(AmbientSource s, float targetVolume) { foreach (var ap in s.players) { targetVolume *= s.volumeModifier; float currentVolume = ap.GetVolume(); ap.SetVolume(currentVolume + (targetVolume - currentVolume) * Timeg.safeDeltaUnscaled(convergeVolumeSpeed)); } }
void PlaceAmbientSound(AmbientSource s, GameObject location) { AudioPlayer ap = AmbientManager.PlaceAmbientSound(location, s.clips.GetRandom(), s.constantLoop, false); ap.SetMinDistance(s.minAudioDistance); ap.SetMaxDistance(s.maxAudioDistance); ap.SetPitch(Randomg.Range(s.minPitch, s.maxPitch)); ap.SetOnRemoveListener(delegate() { AudioPlayer myself = ap; s.players.Remove(myself); }); if (s.randomClipTime) { ap.SetTimePercentage(Randomg.Range01()); } s.players.Add(ap); }
void SetTimer(AmbientSource s) { s.currentTimer = Randomg.Range(s.minInterval, s.maxInterval); }
public void addAmbience(AmbientSource source) { ambience = source; }