示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        var hitVelocity = collision.relativeVelocity.magnitude;

        if (hitVelocity >= HitVelocityThreshold)
        {
            var volume = CoolMath.SmoothStep(0.7f * HitVelocityThreshold, 2 * HitVelocityThreshold, hitVelocity);
            MirroredAudioSource.PlayClipAtPoint(CollisionSound, transform.position, volume);
        }
    }
示例#2
0
 private void OnRoar()
 {
     MirroredAudioSource.PlayClipAtPoint(RoarSound, transform.position);
 }
示例#3
0
 private void OnStep()
 {
     MirroredAudioSource.PlayClipAtPoint(stepSwitch ? StepSound1 : StepSound2, transform.position, StepVolume);
     stepSwitch = !stepSwitch;
 }