Inheritance: MassiveBodyBase
コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: zlynn1990/SpaceSim
        private void LoadSolarSystem()
        {
            _sun = new Sun();

            var mercury = new Mercury();
            var venus = new Venus();
            var earth = new Earth();
            var moon = new Moon(earth.Position, earth.Velocity);
            var mars = new Mars();
            var jupiter = new Jupiter();
            var europa = new Europa(jupiter.Position, jupiter.Velocity);
            var saturn = new Saturn();

            _massiveBodies = new List<IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            ResolveMassiveBodyParents();

            // Simulate the planets out to May 2018 with a 6000 second time step
            OrbitHelper.SimulateToTime(_massiveBodies, new DateTime(2018, 5, 1), 300);

            _spaceCrafts = new List<ISpaceCraft>();

            for (int i = 0; i < ProfileDirectories.Count; i++)
            {
                string profileDirectory = ProfileDirectories[i];

                //List<ISpaceCraft> spaceCraft = SpacecraftFactory.BuildSpaceCraft(mars, profileDirectory, i * 30);
                List<ISpaceCraft> spaceCraft = SpacecraftFactory.BuildSpaceCraft(earth, profileDirectory, i * -60);

                _spaceCrafts.AddRange(spaceCraft);
            }

            // Initialize the spacecraft controllers
            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                spaceCraft.InitializeController(_eventManager);
            }

            // Start at nearly -Math.Pi / 2
            var itsMount = new ITSMount(-1.570795, -69, earth);
            var strongback = new Strongback(-1.5708048, -32, earth);

            // Start downrange at ~300km
            //var asds = new ASDS(-1.8303485, 26, earth);

            _gravitationalBodies = new List<IGravitationalBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                _gravitationalBodies.Add(spaceCraft);
            }

            _structures = new List<StructureBase>
            {
                itsMount,
                strongback,
                //asds
            };

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCrafts.FirstOrDefault());

            ResolveSpaceCraftParents();
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: rdancer/SpaceSim
        private void LoadSolarSystem()
        {
            _sun = new Sun(DVector2.Zero, DVector2.Zero);

            var mercury = new Mercury();
            var venus = new Venus();
            var earth = new Earth();

            _strongback = new Strongback(new DVector2(10, -earth.SurfaceRadius + 38), earth);

            var moon = new Moon(earth.Position, earth.Velocity);
            var mars = new Mars();
            var jupiter = new Jupiter();
            var europa = new Europa(jupiter.Position + new DVector2(6.64862e8, 0), jupiter.Velocity + new DVector2(0, -13740));
            var saturn = new Saturn();

            _massiveBodies = new List<IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            _structures = new List<StructureBase>
            {
                _strongback
            };

            _spaceCrafts = SpacecraftFactory.BuildFalconHeavy(earth, ProfileDirectory);

            _gravitationalBodies = new List<IGravitationalBody>
            {
                _sun, mercury, venus, earth
            };

            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                _gravitationalBodies.Add(spaceCraft);
            }

            _gravitationalBodies.Add(moon);
            _gravitationalBodies.Add(mars);
            _gravitationalBodies.Add(jupiter);
            _gravitationalBodies.Add(europa);
            _gravitationalBodies.Add(saturn);

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCrafts.FirstOrDefault());
        }