示例#1
0
    /// <summary>
    /// Detach the active stage and enable the next one if present.
    /// </summary>
    private void DropStage()
    {
        // automatic staging when a preceeding stage runs out of fuel (engine still on)
        if (multiStage.activeStage < multiStage.numStages)
        {
            // release stage as child, add to GravityEngine
            GameObject spentStage = stages[multiStage.activeStage];
            spentStage.transform.parent = null;
            // add an NBody component,so GE can manage the stage
            NBody nbody = spentStage.AddComponent <NBody>();
            nbody.initialPos = spentStage.transform.position;
            nbody.vel        = shipNbody.vel;
            // Add an atmosphere model, copy general values from rocket and then adjust
            EarthAtmosphere stageAtmosphere = spentStage.AddComponent <EarthAtmosphere>();
            stageAtmosphere.InitFrom(atmosphere, nbody);
            stageAtmosphere.coeefDrag          = multiStage.coeefDrag[multiStage.activeStage];
            stageAtmosphere.crossSectionalArea = multiStage.crossSectionalArea[multiStage.activeStage];
            stageAtmosphere.inertialMassKg     = multiStage.massStageEmpty[multiStage.activeStage];

            GravityEngine.Instance().AddBody(spentStage);

            // activate the next stage
            multiStage.NextStage();
            multiStage.SetEngine(true);
            GravityEngine.Instance().TrajectoryRestart();
            DisplayManager.Instance().DisplayMessage("Staging");
        }
        else
        {
            multiStage.SetEngine(false);
            DisplayManager.Instance().DisplayMessage("Engine Shutdown");
        }
    }
示例#2
0
    private void Update()
    {
        //ObjectsStorage.Ints.Satel1.transform.position = new Vector3((float)1.3 + (RadSlider.value / 1000 - 1), ObjectsStorage.Ints.Satel1.transform.position.y, ObjectsStorage.Ints.Satel1.transform.position.z);
        //ObjectsStorage.Ints.Satel2.transform.position = new Vector3((float)1 - (RadSlider.value / 1000 - 1), 1 + (RadSlider.value / 1000 - 1), ObjectsStorage.Ints.Satel1.transform.position.z);
        //ObjectsStorage.Ints.Satel3.transform.position = new Vector3(ObjectsStorage.Ints.Satel1.transform.position.x, (float)-1.4 - (RadSlider.value / 1000 + 1), ObjectsStorage.Ints.Satel1.transform.position.z);
        //ObjectsStorage.Ints.Satel4.transform.position = new Vector3(ObjectsStorage.Ints.Satel1.transform.position.x, (float)1.5 + (RadSlider.value / 1000 - 1), ObjectsStorage.Ints.Satel1.transform.position.z);

        float value = _radSlider.value;

        value *= 20;

        //if( Math.Abs( _previousRadiusValue - value ) < 0.001 )
        //{
        //	return;
        //}


        if (Math.Abs(_previousRadiusValue - value) >= 0.001)
        {
            CameraRotator.MoveZ(_previousRadiusValue > value
                                ? -value
                                : value
                                );
            _previousRadiusValue = value;
        }


        PlanetConfigurator.SetRadius(value);
        EarthAtmosphere.SetRadius(value);
        UpdateRadiusText(_radSlider.value);
    }
 public void InitFrom(EarthAtmosphere atm, NBody nbody)
 {
     this.earth              = atm.earth;
     this.spaceship          = nbody;
     this.heightEarthSurface = atm.heightEarthSurface;
     this.inertialMassKg     = atm.inertialMassKg;
     this.crossSectionalArea = atm.crossSectionalArea;
     this.coeefDrag          = atm.coeefDrag;
 }