Exemplo n.º 1
0
        public SpaceShooterGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferHeight  = 720;
            graphics.PreferredBackBufferWidth   = 1280;
            graphics.MinimumPixelShaderProfile  = ShaderProfile.PS_2_0;
            graphics.MinimumVertexShaderProfile = ShaderProfile.VS_2_0;

            chaseCamera = new ChaseCamera(this);

            particles        = new ParticleManager(this);
            particles.Camera = chaseCamera;
            Components.Add(particles);

            playerShip = new PlayerShip(this, particles);

            enemyShip = new SpaceShip(this, particles);

            boltManager = new BoltManager(this, particles);

            skyBox         = new SkyBox(this);
            skyBox.Visible = false;
            Components.Add(skyBox);

            earth = new Planet(this);
            air   = new Atmosphere(this);
            sun   = new Sun(this);

            motionField = new MotionField(this);

            bloomComponent = new BloomComponent(this);
            Components.Add(bloomComponent);
        }
        public FrameworkCore()
            : base()
        {
#if WINDOWS && STEAM
            steam = new ManagedSteam();
#endif



            game = this;

#if LiveEnabled
            Components.Add(new GamerServicesComponent(this));

            //DELETE ME
            //Guide.SimulateTrialMode = true;
#endif

            options        = new Options();
            storageManager = new StorageManager();


            highScores = new HighScoreEntry();


#if WINDOWS
            OptionsData optionsData = storageManager.LoadOptionsPC();
            options.bloom      = optionsData.bloom;
            options.fullscreen = optionsData.isFullscreen;

            options.renderPlanets = optionsData.renderPlanets;
            options.mousewheel    = optionsData.mousewheel;
            options.sensitivity   = optionsData.sensitivity;
            options.hardwaremouse = optionsData.hardwaremouse;
            options.manualDefault = optionsData.manualDefault;

            options.resolutionX = optionsData.VideoWidth;
            options.resolutionY = optionsData.VideoHeight;

            options.p1UseMouse = optionsData.player1UseMouse;
            options.p2UseMouse = optionsData.player2UseMouse;

            options.fixedTimeStep = optionsData.fixedTimeStep;
            options.vsync         = optionsData.vsync;

            if (options.hardwaremouse)
            {
                Game.IsMouseVisible = true;
            }
#endif



            graphics = new GraphicsDeviceManager(this);
#if XBOX
            if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width < 1920)
            {
                graphics.PreferredBackBufferHeight = 720;
                graphics.PreferredBackBufferWidth  = 1280;
            }
            else
            {
                graphics.PreferredBackBufferHeight = 1080;
                graphics.PreferredBackBufferWidth  = 1920;
            }
#elif ONLIVE
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferredBackBufferWidth  = 1280;
            graphics.IsFullScreen = true;
#else
            //PC
            //graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            //graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;


            graphics.PreferredBackBufferHeight = optionsData.VideoHeight;
            graphics.PreferredBackBufferWidth  = optionsData.VideoWidth;
            graphics.IsFullScreen = optionsData.isFullscreen;

            game.IsFixedTimeStep = optionsData.fixedTimeStep;
            graphics.SynchronizeWithVerticalRetrace = optionsData.vsync;
            graphics.ApplyChanges();
#endif



            particles = new ParticleManager(this);

            contentManager = new ContentManager(Services, "Content");

            boltManager = new BoltManager(this, particles);



            bloomComponent = new BloomComponent(this);


            Meshrenderer       = new MeshRenderer();
            playerMeshRenderer = new MeshRenderer();

            playbackSystem   = new PlaybackSystem();
            worldTextManager = new WorldTextManager(this);
            debrismanager    = new DebrisManager();
            hulkmanager      = new HulkManager();



            audioManager = new AudioManager();

            sysmenumanager = new SysMenuManager();
            level          = new Level();

            for (int i = 0; i < 4; i++)
            {
                PlayerIndex index = PlayerIndex.One;

                if (i == 0)
                {
                    index = PlayerIndex.One;
                }
                else if (i == 1)
                {
                    index = PlayerIndex.Two;
                }
                else if (i == 2)
                {
                    index = PlayerIndex.Three;
                }
                else
                {
                    index = PlayerIndex.Four;
                }

                menuInputs[i] = new InputManager(index);
            }

#if WINDOWS
    #if !TRIAL
            //check for full version files.
            isPirated = IsMissingFiles();
    #endif
#endif
        }