public void ReduceSpeed() { movingSpeed -= 300 * weight / 350; foreach (GameObject wheelObject in ((CarObject)_GameObject).getWheelObjects()) { RotatingObject rotatingObject = wheelObject.GetComponent <RotatingObject>(); rotatingObject.UpdateSpeed(0f, 0f, movingSpeed / 10f); } }
/// <summary> /// Slowly increase speed and make wheels rotate more as speed increases /// </summary> void updateSpeed(CarObject carObject) { movingSpeed += weight / 350; foreach (GameObject wheelObject in carObject.getWheelObjects()) { RotatingObject rotatingObject = wheelObject.GetComponent <RotatingObject>(); rotatingObject.UpdateSpeed(0f, 0f, movingSpeed / 10f); } }