示例#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;
        }
示例#2
0
        /// <summary>
        /// Draws the heads up display to the specified sprite batch.
        /// Draws the HUD to the display
        /// </summary>
        /// <param name="spriteBatch">The sprite batch.</param>
        /// <param name="view">The view.</param>
        /// <param name="lem">The lem.</param>
        /// <param name="wind">The wind vector.</param>
        public void Draw(SpriteBatch spriteBatch, Viewport view, Lem lem, Vector3 wind, int score, bool store, int points)
        {
            spriteBatch.Draw(_texture, Vector2.Zero, Color.White);

            if (store)
            {
                spriteBatch.Draw(_fuelAvailable, new Vector2(view.Width - _fuelAvailable.Width, view.Height - _fuelAvailable.Height), Color.White);
            }
            else if (lem.Fuel < 10)
            {
                spriteBatch.Draw(_fuelLow, new Vector2(view.Width - _fuelLow.Width, view.Height - _fuelLow.Height), Color.White);
            }
            else
            {
                spriteBatch.Draw(_fuelNormal, new Vector2(view.Width - _fuelNormal.Width, view.Height - _fuelNormal.Height), Color.White);
            }

            float height = _font.MeasureString("_").Y;

            spriteBatch.DrawString(_font,
                                   string.Format(@"X Rot.: {0:0.00}", MathHelper.ToDegrees(lem.RotationX)),
                                   new Vector2(180, 0),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);

            spriteBatch.DrawString(_font,
                                   string.Format(@"Y Rot.: {0:0.00}", MathHelper.ToDegrees(lem.RotationZ)),
                                   new Vector2(180, height),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);

            spriteBatch.DrawString(_font,
                                   string.Format(@"Wind:   {0:0.0} km\h {1}", GetWindSpeed(wind.X, wind.Z), GetCardinalDirection(wind.X, wind.Z)),
                                   new Vector2(590, 0),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);
            spriteBatch.DrawString(_font,
                                   string.Format(@"Height: {0:0.00}", (lem.Position.Y - Lem.MinY) / Lander.Metre.Y),
                                   new Vector2(590, height),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);

            spriteBatch.DrawString(_font,
                                   string.Format(@"Fuel:  {0:0.00}", lem.Fuel),
                                   new Vector2(370, 0),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);
            spriteBatch.DrawString(_font,
                                   string.Format(@"Money: {0:0.00}", score),
                                   new Vector2(370, height),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);
            spriteBatch.DrawString(_font,
                                   string.Format(@"Points: {0:0.00}", points),
                                   new Vector2(370, height * 2),
                                   Color.Black, 0.0f,
                                   Vector2.Zero,
                                   1.0f, SpriteEffects.None, 0.0f);
        }