protected virtual void Update() { this.CurrentState.Update(this); this.UpdateHorizontalSpeed(); this.ApplyMotion(); if (isWalking) { stepSoundRate = .75f; } if (isJogging) { stepSoundRate = .5f; } if (isSprinting) { stepSoundRate = .35f; } if (HorizontalVelocity != Vector3.zero && IsGrounded && Time.time >= lastStepSound + stepSoundRate) { AudioManager.SoundParams s = new AudioManager.SoundParams() { pitch = Random.Range(0.1f, 2.0f), volume = .65f }; AudioManager.Instance.PlaySound(stepSound, transform.position - (Vector3.up * .5f), parameters: s); lastStepSound = Time.time; } }
private void Start() { AudioManager.SoundParams s = new AudioManager.SoundParams(volume, true, ""); AudioManager.Instance.PlayMusic(music, s); }