예제 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            spaceship         = new Spaceship(spaceshipOrientationMatrix * Matrix.CreateTranslation(spaceshipPosition), Content);
            skybox            = new Skybox(Matrix.CreateScale(1000f) * Matrix.CreateTranslation(cameraPosition), Content);
            reticle           = Content.Load <Texture2D>("Reticle");
            reticleHalfWidth  = reticle.Width / 2f;
            reticleHalfHeight = reticle.Height / 2f;
            controls          = Content.Load <Texture2D>("Controls");

            IsMouseVisible = false;
        }
예제 #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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            skybox = new Skybox("Textures/Background1", Content);

            spriteFont = Content.Load <SpriteFont>("Fonts/Font1");

            gameManager.RegisterModel(EntityType.Asteroid, new GameModel(GraphicsDevice, Content, "Models/asteroid"));
            //gameManager.RegisterModel(EntityType.Player, new GameModel(GraphicsDevice, Content, "Models/Ship"));
            gameManager.RegisterModel(EntityType.PlanetEarth, new GameModel(GraphicsDevice, Content, "Models/earth"));

            ShipEntity playerEntity = new ShipEntity(this, new Sphere(new BEPUutilities.Vector3(0, 10, 350), 1, 100));

            playerEntity.SetScale(0.001f);
            cameraTarget = gameManager.RegisterEntity(playerEntity);

            PlanetEntity earthEntity = new PlanetEntity(this, EntityType.PlanetEarth, new Sphere(new BEPUutilities.Vector3(0, 0, -200), 225));

            earthEntity.SetScale(50f);
            earthEntity.PhysicsEntity.AngularVelocity = MathConverter.Convert(new Vector3(0.005f, 0.001f, 0.001f));
            earthEntity.PhysicsEntity.AngularDamping  = 0f;
            gameManager.RegisterEntity(earthEntity);

            inputManager = new InputManager(this, gameManager, playerEntity);

            GenerateAsteroids();

            textureRearviewMirror          = Content.Load <Texture2D>("Textures/rearviewmirror");
            textureRearviewMirrorMask      = Content.Load <Texture2D>("Textures/rearviewmirror_mask");
            textureSideviewMirrorLeft      = Content.Load <Texture2D>("Textures/sideviewmirrorleft");
            textureSideviewMirrorLeftMask  = Content.Load <Texture2D>("Textures/sideviewmirrorleft_mask");
            textureSideviewMirrorRight     = Content.Load <Texture2D>("Textures/sideviewmirrorright");
            textureSideviewMirrorRightMask = Content.Load <Texture2D>("Textures/sideviewmirrorright_mask");

            rearviewMirrorMask      = new Color[textureRearviewMirrorMask.Width * textureRearviewMirrorMask.Height];
            sideviewMirrorLeftMask  = new Color[textureSideviewMirrorLeftMask.Width * textureSideviewMirrorLeftMask.Height];
            sideviewMirrorRightMask = new Color[textureSideviewMirrorRightMask.Width * textureSideviewMirrorRightMask.Height];
            textureRearviewMirrorMask.GetData(rearviewMirrorMask);
            textureSideviewMirrorLeftMask.GetData(sideviewMirrorLeftMask);
            textureSideviewMirrorRightMask.GetData(sideviewMirrorRightMask);

            starfield = new Starfield(this, spriteBatch, Window.ClientBounds.Width, Window.ClientBounds.Height);

            InitializeCamera();
        }