public void Restart() { theGameState = GameStates.GS_USER_INPUT; earthRadius = Mathf.Pow((3.0f * MASS_EARTH_IN_KG) / (4.0f * Mathf.PI * DENSITY_EARTH_IN_KG_PER_CUBIC_METER), 1.0f / 3.0f); //in meters earthEscape = CalculateEscapeVelocityFromEarth(earthRadius); print("Earth's Mass = " + MASS_EARTH_IN_KG + "kg, earthRadius = " + earthRadius / 1000.0f + "km, escape velocity = " + earthEscape + "m/s"); //reset the rocket if (theRocket != null) { theRocket.Restart(); } }
public void Restart() { theGameState = GameStates.GS_USER_INPUT; //reset Terra Firma's mass tfMass = UnityEngine.Random.Range(MIN_TF_MASS, MAX_TF_MASS) * MASS_EARTH_IN_KG; tfRadius = Mathf.Pow((3.0f * tfMass) / (4.0f * Mathf.PI * DENSITY_TF_IN_KG_PER_CUBIC_METER), 1.0f / 3.0f); //in meters tfEscape = CalculateEscapeVelocityFromTerraFirma(tfRadius); print("tfMass = " + tfMass + "kg, tfRadius = " + tfRadius / 1000.0f + "km, escape velocity = " + tfEscape + "m/s"); //reset the rocket if (theRocket != null) { theRocket.Restart(); } }