private void GenerateLocalScene() { PlanetRegistry.PersistThroughScenes = true; ActivatePlanets(); InstantiateSunlight(); // TODO: replace this with a query to server about what planet we are near CurrentNearestOrbitingBody = getPlanet(OrbitingBody.EARTH); }
ChangePlanetsScale (List <GameObject> planets, Scale targetScale) { foreach (GameObject Planet in planets) { OrbitingBodyBackgroundGameObject PlanetManager = Planet.GetComponent <OrbitingBodyBackgroundGameObject>(); MyContract.RequireArgumentNotNull(PlanetManager, PlanetManagerName); PlanetManager.SetScaleToPredefinedScale(targetScale); } }
ChangePlanetsScale (List <GameObject> planets, float targetLinearScale) { foreach (GameObject Planet in planets) { OrbitingBodyBackgroundGameObject PlanetManager = Planet.GetComponent <OrbitingBodyBackgroundGameObject>(); MyContract.RequireArgumentNotNull(PlanetManager, PlanetManagerName); PlanetManager.SetRelativeLinearScaleExplicitly(targetLinearScale); } }
/// <summary> /// Warps to warp_target, at ORBIT_DISTANCE in the direction of the sun /// (i.e. warps to the sunny side of the target) /// </summary> /// <param name="warpTarget"></param> public void WarpTo(OrbitingBodyBackgroundGameObject warpTarget) { // shitty lock - DO NOT RELY ON THIS if (warping) { Debug.Log("Already warping! Not warping again"); return; } warping = true; // direction from origin Vector3 current_target_vector = warpTarget .GetCurrentGameSolarSystemCoordinates(); Vector3 normalised_target_vector = current_target_vector.normalized; double orbit_distance_in_solar_system_scale = ORBIT_DISTANCE_IN_METRES / OrbitingBodyMathematics.DISTANCE_SCALE_TO_METRES; // var name is in capitals - Solar system scale DISTANCE float sdistance = System.Convert.ToSingle( current_target_vector.magnitude - orbit_distance_in_solar_system_scale ); Vector3 SolarScaleOrbitCoordinates = normalised_target_vector * sdistance; double orbit_distance_in_nearest_planet_scale = Scale.NearestPlanet .ConvertMeasurementFromMetres(ORBIT_DISTANCE_IN_METRES); // var name is in capitals - Nearest planet scale DISTANCE float ndistance = System.Convert.ToSingle(orbit_distance_in_nearest_planet_scale); // need to go backwards i.e. towards the sun to be on the sunny side Vector3 NearestPlanetScaleOrbitCoordinates = -normalised_target_vector * ndistance; // Solar System Warps CurrentNearestOrbitingBody.ChangeToSolarSystemReferenceFrame(); CameraRegistry[(int)CameraRoles.SolarSystem] .GetComponent <LargeScaleCamera>() .WarpTo(SolarScaleOrbitCoordinates); // Orbital Warps warpTarget.ChangeToOrbitalReferenceFrame(); warpTarget.UpdateSunDirection(nearest_planet_sunlight); CameraRegistry[(int)CameraRoles.NearestPlanet] .GetComponent <LargeScaleCamera>() .WarpTo(NearestPlanetScaleOrbitCoordinates); // Playable Area Warp //transform.position = new Vector3(0, 0, 0); //Debug.Log("TODO: warp player position (maybe?) (CURRENTLY DOES NOTHING)"); CurrentNearestOrbitingBody = warpTarget; warping = false; }
public void SetExplicitDateTime(DateTime explicitTime) { Debug.Log("Setting Explicit DateTime in OrreryManager"); foreach (GameObject PlanetObj in Planets) { OrbitingBodyBackgroundGameObject OBBGO = PlanetObj.GetComponent <OrbitingBodyBackgroundGameObject>(); MyContract.RequireFieldNotNull( OBBGO, "OrbitingBodyBackgroundGameObject" ); OBBGO.UseExplicitDateTime(explicitTime); } }
ChangePlanetsScale (List <GameObject> planets, float logBase, float innerMultiplier, float outerMultiplier) { foreach (GameObject Planet in planets) { OrbitingBodyBackgroundGameObject PlanetManager = Planet.GetComponent <OrbitingBodyBackgroundGameObject>(); MyContract.RequireArgumentNotNull( PlanetManager, PlanetManagerName ); PlanetManager.SetRelativeLogarithmicScaleExplicitly( logBase, innerMultiplier, outerMultiplier ); } }