예제 #1
0
        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);
        }
예제 #2
0
 ChangePlanetsScale
     (List <GameObject> planets, Scale targetScale)
 {
     foreach (GameObject Planet in planets)
     {
         OrbitingBodyBackgroundGameObject PlanetManager
             = Planet.GetComponent <OrbitingBodyBackgroundGameObject>();
         MyContract.RequireArgumentNotNull(PlanetManager, PlanetManagerName);
         PlanetManager.SetScaleToPredefinedScale(targetScale);
     }
 }
예제 #3
0
 ChangePlanetsScale
     (List <GameObject> planets, float targetLinearScale)
 {
     foreach (GameObject Planet in planets)
     {
         OrbitingBodyBackgroundGameObject PlanetManager
             = Planet.GetComponent <OrbitingBodyBackgroundGameObject>();
         MyContract.RequireArgumentNotNull(PlanetManager, PlanetManagerName);
         PlanetManager.SetRelativeLinearScaleExplicitly(targetLinearScale);
     }
 }
예제 #4
0
        /// <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;
        }
예제 #5
0
 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);
     }
 }
예제 #6
0
 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
             );
     }
 }