public override void PhysicsUpdate()
{
// handle goldenGear
if (isGolden) {
if (!hasPlayerGear)
curSpeed = 0;
if (Application.isPlaying) {
if (!goldenRotating.isPlaying) goldenRotating.Play();
goldenRotating.volume = _goldenRotating.volume*SoundProfile.effects*Mathf.Abs(AngularVelocityToCurSpeed()/maxSpeed);
goldenRotating.pitch = SemitonesToPitch(Mathf.Abs(goldenRotation)*18/360-6);
//particles.emission.rate = 15 *Mathf.Abs (AngularVelocityToCurSpeed () / maxSpeed) * .2;
if (CurSpeedToAngularVelocity()!=0) {
particlesS.Pause ();
particlesF.Play ();
}
}
goldenRotation += Time.fixedDeltaTime*CurSpeedToAngularVelocity();
if (Mathf.Abs(goldenRotation) > 360) {
goldenRotated.volume = _goldenRotated.volume*SoundProfile.effects;
goldenRotated.Play();
GameObject.FindObjectOfType<Pause>().EndLevel();
return;
}
}
base.PhysicsUpdate();
}