示例#1
0
        protected override void LoadContent()
        {
            texNorm = Content.Load <Effect>("Shaders\\TextureNormal");
            font    = Content.Load <SpriteFont>("Fonts\\SpriteFont1");
            //gameWorld.LoadContent();
            asterTex = Content.Load <Texture2D>("Models\\fbx\\asteroid");
            skyTex   = new Texture2D(GraphicsDevice, 2048, 2048);

            proceduralSpace(skyTex, 2048, 2048, 1000, 1);
            // Create a new SpriteBatch
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), spriteBatch);
            pe     = Content.Load <Effect>("Shaders\\particle");
            pimage = Content.Load <Texture2D>("Images\\Particle");
            pe.Parameters["pic"].SetValue(pimage);

            // Load Audio Elements
            audio = new AudioLibrary();
            audio.LoadContent(Content);
            Services.AddService(typeof(AudioLibrary), audio);

            menuScene = new MenuScene(this);
            Components.Add(menuScene);
            menuScene.Show();

            level1Scene = new Level1Scene(this);
            Components.Add(level1Scene);

            activeScene = menuScene;

            base.LoadContent();
        }
示例#2
0
        public Level1Scene(Game game)
            : base(game)
        {
            // Get the current sprite batch
            spriteBatch = (SpriteBatch)
                          Game.Services.GetService(typeof(SpriteBatch));

            theCamera = new Camera(1280, 1024);
            game.Services.AddService(typeof(Camera), theCamera);

            // Get the audio library
            audio = (AudioLibrary)
                    Game.Services.GetService(typeof(AudioLibrary));



            player = new GameObject.Player(game, new Vector3(0, 0, 300));
            Components.Add(player.Health);
            Components.Add(player.Score);

            tunnel          = new GameObject.Tunnel(game, 200, 200);
            skybox          = new SkyBox(game);
            bulletManager   = new BulletManager(game);
            asteroidManager = new AsteroidManager(game);



            pgen  = new ParticleSystem(game, Game1.pe);
            game1 = game;

            Load();
        }
示例#3
0
        public MenuScene(Game game)
            : base(game)
        {
            Load();
            backgroundRect = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height);
            menuItems      = new List <string>();
            string[] items = { "Start", "Quit" };
            SetMenuItems(items);

            // Get the audio library
            audio = (AudioLibrary)
                    Game.Services.GetService(typeof(AudioLibrary));

            // Get the current spritebatch
            spriteBatch = (SpriteBatch)Game.Services.GetService(
                typeof(SpriteBatch));
            // Used for input handling
            oldKeyboardState = Keyboard.GetState();
        }