Exemple #1
0
        public void NewGame()
        {
            _points = 0;
            _currentObjective.Model = _landingPad;
            _currentObjective       = _pads[1];
            _currentObjective.Model = _landingPadGreen;

            _menu.MainMenuIndex      = _menu.Screens.IndexOf(_pause);
            _menu.SelectedMenuScreen = _menu.MainMenuIndex;
            _lem.Dispose();
            _lem = new Lem();
            _lem.Init(new Vector3(0, 3.05f * Metre.Y + Lem.MinY, 0), _lemModel, _flame, _currentGravity, 100, _soundEffect, _audioListener);
            _running = true;
        }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            _mainView = GraphicsDevice.Viewport;

            _bottomView        = _mainView;
            _bottomView.Height = _mainView.Height / 3;
            _bottomView.Width  = _bottomView.Height;
            _bottomView.X      = 2;
            _bottomView.Y      = 2;

            _spriteBatch     = new SpriteBatch(GraphicsDevice);
            _grassTexture    = Content.Load <Texture2D>("Images\\grass");
            _fuelBlack       = Content.Load <Texture2D>("Images\\fuelBlack");
            _fuelGreen       = Content.Load <Texture2D>("Images\\fuelGreen");
            _fuelRed         = Content.Load <Texture2D>("Images\\fuelRed");
            _lemModel        = Content.Load <Model>("models\\LEM\\LEM");
            _menuMove        = Content.Load <SoundEffect>("Sounds\\menuMove");
            _menuSelect      = Content.Load <SoundEffect>("Sounds\\menuSelect");
            _scoreFont       = Content.Load <SpriteFont>("Fonts\\Mono");
            _menuBack        = Content.Load <SoundEffect>("Sounds\\menuBack");
            _flame           = Content.Load <Model>("models\\jet\\jet");
            _landingPad      = Content.Load <Model>("models\\landingPad\\landingPad");
            _landingPadGreen = Content.Load <Model>("models\\landingPad\\landingPadGreen");

            var hudTexture = Content.Load <Texture2D>("Images\\hud");

            _hud = new HeadsUpDisplay(_scoreFont, hudTexture, _fuelBlack, _fuelRed, _fuelGreen);

            _menu.Initialize(GraphicsDevice.Viewport, _scoreFont, _menuMove, _menuSelect, _menuBack);

            _soundEffect = Content.Load <SoundEffect>("Sounds\\engine");

            var ground = new Ground();

            ground.Init(_textureEffect, _textureEffectWvp, _textureEffectImage, _grassTexture, _groundVertices);

            //Equitorial Surface Body as listed on Wikipedia
            _gravity.Add("sun", new Body(new Vector3(0, -274.0f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("mercury", new Body(new Vector3(0, -3.7f, 0), new Vector3(-.1f, 0.0f, .001f), ground));
            _gravity.Add("venus", new Body(new Vector3(0, -8.87f, 0), new Vector3(0.1f, 0.0f, 0.15f), ground));
            _gravity.Add("earth", new Body(new Vector3(0, -9.780327f, 0), new Vector3(.25f, 0.0f, 0.0f), ground));
            _gravity.Add("moon", new Body(new Vector3(0, -1.622f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("mars", new Body(new Vector3(0, -3.711f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("jupiter", new Body(new Vector3(0, -24.79f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("saturn", new Body(new Vector3(0, -10.44f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("uranus", new Body(new Vector3(0, -8.69f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("neptune", new Body(new Vector3(0, -11.15f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));
            _gravity.Add("pluto", new Body(new Vector3(0, -0.658f, 0), new Vector3(0.0f, 0.0f, 0.0f), ground));

            _currentGravity = _gravity["moon"];


            InitMenu();

            _lem.Init(new Vector3(0, 3.05f * Metre.Y + Lem.MinY, 0), _lemModel, _flame, _currentGravity, 100, _soundEffect, _audioListener);

            var pad = new LandingPad();

            pad.Init(new Vector3(0, 3, 0) * Metre, _landingPad);
            _pads.Add(pad);
            pad = new LandingPad();
            pad.Init(new Vector3(15, 3, -30) * Metre, _landingPadGreen);
            _pads.Add(pad);
            _currentObjective = pad;
            pad = new LandingPad();
            pad.Init(new Vector3(45, 3, -60) * Metre, _landingPad);
            _pads.Add(pad);
            pad = new LandingPad();
            pad.Init(new Vector3(90, 3, -40) * Metre, _landingPad);
            _pads.Add(pad);
            pad = new LandingPad();
            pad.Init(new Vector3(60, 3, 50) * Metre, _landingPad);
            _pads.Add(pad);
            pad = new LandingPad();
            pad.Init(new Vector3(30, 3, 40) * Metre, _landingPad);
            _pads.Add(pad);
            pad = new LandingPad();
            pad.Init(new Vector3(0, 3, 30) * Metre, _landingPad);
            _pads.Add(pad);
        }