public void Play(Effects.Source source) { durationRemaining = duration; if (!source.clips.Contains(this)) { source.clips.Add(this); } }
void Initialize(Effects.Source source) { if (initialized) { return; } audioSource = source.parent.gameObject.AddComponent <AudioSource>(); audioSource.rolloffMode = AudioRolloffMode.Linear; audioSource.spatialBlend = 0f; initialized = true; }
public void Play(Effects.Source source) { Initialize(source); audioSource.clip = sound; audioSource.Stop(); audioSource.pitch = pitch; audioSource.loop = loop; audioSource.clip = sound; audioSource.volume = 0f; audioSource.Play(); if (!source.clips.Contains(this)) { source.clips.Add(this); } }
// Use this for initialization void Start() { scrFpsController = transform.root.GetComponent <ScrFpsController>(); scrFpsWeaponPivot = transform.GetComponent <ScrFpsWeaponPivot>(); sfxSource = transform.root.GetComponent <ScrEffectsListener>().personalEffects; headCamera = scrFpsController.headCamera.GetComponent <Camera>(); headCameraOrigFov = headCamera.fieldOfView; weaponCamera = scrFpsController.weaponCamera.GetComponent <Camera>(); weaponCameraOrigFov = weaponCamera.fieldOfView; fireTimer.onIterate += SpawnProjectiles; fireTimer.onCooldown += C**k; magazineCurrent = magazineMax; }
public void Play(Effects.Source source) { if (fadeTimer == null) { fadeTimer = new DsLib.CyclicTimer(fadeInDuration, fadeOutDuration, 1, peakDuration, loop, false); } else { fadeTimer.Configure(fadeInDuration, fadeOutDuration, 1, peakDuration, loop, false); } noisePositionOffsetCurrent = UnityEngine.Random.Range(0f, 100f); noiseRotationOffsetCurrent = UnityEngine.Random.Range(0f, 100f); if (!source.clips.Contains(this)) { source.clips.Add(this); } fadeTimer.Start(DsLib.CyclicTimer.StartMode.Forced); }
public void Stop(Effects.Source source) { durationRemaining = 0f; source.clips.Remove(this); }
public void Stop(Effects.Source source) { fadeTimer.Reset(); source.clips.Remove(this); }
public void Stop(Effects.Source source) { audioSource.Stop(); source.clips.Remove(this); }