protected override void PlayDeathEffects_RPC() { PlayDeathTrailEffects(true); inputDriver.enabled = false; rb.linearDamping = 75f; rb.angularDamping = 75f; icd4.isDead = true; float x, y, z; x = Random.Range(-0.2f, 0.2f); if (x < 0) { x -= 1.3f; } else { x += 1.3f; } y = 0.9f; z = Random.Range(0.3f, 1.6f); if (lastHitDetails.damageType != Weapon.DamageType.ramming) { rb.centreOfMass = new Vector3(0, 0.6f, 0); Vector3 explodePos = new Vector3(x, y, z); rb.angularDamping = 0.1f; rb.AddForce(explodePos * rb.mass * 8f, ForceMode.Impulse); rb.AddTorque(explodePos * rb.mass * 3f, ForceMode.Impulse); } smokeM.Play(); smokeH.Play(); StartCoroutine(stopControls(1.7f)); }
void IDrivable.Brake() { //brake all wheels foreach (wheelStruct ws in wheelStructs) { ws.collider.brakeTorque = brakeTorque; } //if all wheels grounded, add additional brake force if (AllWheelsGrounded()) { if (transform.InverseTransformDirection(carRB.velocity).z < 0) { carRB.AddForce(carTransform.forward * brakeForce); } else { carRB.AddForce(carTransform.forward * -brakeForce); } } }