public void LaunchPlayer() { if (LaunchCooldown > 0) { Debug.Log("Is on Launch Cooldown"); return; } if (SFX) { SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); SFX.PlayOneShot(DashSound); } /* * //Launch player in direction of movement //Launch in direction of mouse cursor if not moving * Vector3 launchVelocity = PhysBody.velocity.magnitude > 1 ? PhysBody.velocity.normalized * 500 : transform.forward * 500; * * * PhysBody.AddForce(launchVelocity, ForceMode.Impulse);*/ LaunchCooldown = LaunchCooldownTime; InvokeRepeating("AllowLaunch", launchCooldownRate, launchCooldownRate); PlayerController.GetHealth.EnableInvulnerability(invulnerabilityTime); launchStart = transform.position; GetLaunchPosition(); GetLaunchRate(); InvokeRepeating("Launch", 0, launchRate); isDashing = true; }
void Damaged(int Damage, int Health, GameObject Instigator) { //Cam.CameraShake.Shake(); CameraShake.Shake(0.15f, 0.3f); SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); SFX.Play(); }
void OnTriggerEnter(Collider other) { OnHit(other.gameObject); if (SFX) { SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); } }
void adjustVolume() { //Debug.Log("Adjust Volume Called"); if (source) { source.volume = VolumeControl.GetVolume(EAudioType.MUSIC); } else { //Debug.Log("SOURCE NOT VALID"); } }
// Use this for initialization void Start() { VFX = GetComponent <ParticleSystem>(); FX = GetComponent <AudioSource>(); FX.volume = FX.volume * VolumeControl.GetVolume(EAudioType.EFFECT); VFX.Play(); FX.pitch = Random.Range(PitchRange.x, PitchRange.y); FX.Play(); Destroy(gameObject, lifeTime); }
void PlayWeaponSound() { if (SFX.enabled == false) { return; } SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); float basePitch = SFX.pitch; SFX.pitch = Random.Range(SFX.pitch - .1f, SFX.pitch + .1f); SFX.Play(); SFX.pitch = basePitch; }
void Awake() { if (clip == null) { Destroy(gameObject); return; } source = GetComponent <AudioSource>(); float _volume = 1; if (VolumeControl.instance) { _volume = VolumeControl.GetVolume(audioType); } source.volume = _volume; source.PlayOneShot(clip); StartCoroutine(DestroySound()); //Destroy(gameObject, clip.length); }