void CalculateEnginePower(Vector3 relativeVelocity) { if (throttle == 0) { currentEnginePower -= Time.deltaTime * 1000; } else if (Utilitys.HaveTheSameSign(relativeVelocity.z, throttle)) { float normPower = (currentEnginePower / engineForceValues[engineForceValues.Length - 1]) * 2; currentEnginePower += Time.deltaTime * 200 * Utilitys.EvaluateNormPower(normPower); } else { currentEnginePower -= Time.deltaTime * 300; } if (currentGear == 0) { currentEnginePower = Mathf.Clamp(currentEnginePower, 0, engineForceValues[0]); } else { currentEnginePower = Mathf.Clamp(currentEnginePower, engineForceValues[currentGear - 1], engineForceValues[currentGear]); } }