Exemplo n.º 1
0
        public MainMenuScene(GraphicsDevice graphicsDevice, AudioManager audioManager)
            : base(graphicsDevice)
        {
            particleEffectDelay = 0;

            particleManager = new ParticleManager(10000);
            this.audioManager = audioManager;

            AddActor(new Starfield());
            AddActor(new Grid());
            AddActor(particleManager);
            AddActor(audioManager);

            particleManager.CreateParticles();

            AddPostprocess(new Bloom(new SpriteBatch(graphicsDevice), graphicsDevice));

            random = new Random();
        }
        public SettingsPage()
        {
            audioManager = (Application.Current as App).AudioManager;
            settings = (Application.Current as App).Settings;

            InitializeComponent();

            graphicsDevice = SharedGraphicsDeviceManager.Current.GraphicsDevice;

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;

            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

            LayoutUpdated += new EventHandler(SettingsPage_LayoutUpdated);
        }
Exemplo n.º 3
0
        public GameplayScene(GraphicsDevice graphicsDevice, AudioManager audioManager)
            : base(graphicsDevice)
        {
            EndScene = false;

            ShipManager = new ShipManager(10);
            BulletManager = new BulletManager(100);
            EnemyManager = new EnemyManager(50);
            MultiplierManager = new MultiplierManager(100);
            ParticleManager = new ParticleManager(10000);
            Hud = new HUD(graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height);
            AudioManager = audioManager;

            postgameTimer = TimeSpan.FromSeconds(3);
            gameOver = false;

            AddActor(new Starfield());
            AddActor(new Grid());
            AddActor(ShipManager);
            AddActor(BulletManager);
            AddActor(EnemyManager);
            AddActor(MultiplierManager);
            AddActor(ParticleManager);
            AddActor(Hud);
            AddActor(audioManager);

            ShipManager.CreateShips();
            BulletManager.CreateBullets();
            EnemyManager.CreateEnemies();
            MultiplierManager.CreateMultipliers();
            ParticleManager.CreateParticles();

            AddPostprocess(new Bloom(new SpriteBatch(graphicsDevice), graphicsDevice));

            ShipManager.ActivateShip(true);
            Camera.TargetActor = ShipManager.PlayerShip;
            Hud.PlayerShip = ShipManager.PlayerShip;

            AudioManager.TargetListener = ShipManager.PlayerShip;
            AudioManager.Stop();
        }
Exemplo n.º 4
0
 public MarathonScene(GraphicsDevice graphicsDevice, AudioManager audioManager)
     : base(graphicsDevice, audioManager)
 {
 }
Exemplo n.º 5
0
        // Performs initialization of the XNA types required for the application.
        private void InitializeXnaApplication()
        {
            // Create the service provider
            Services = new AppServiceProvider();

            // Add the SharedGraphicsDeviceManager to the Services as the IGraphicsDeviceService for the app
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
            }

            // Create the ContentManager so the application can load precompiled assets
            Content = new ContentManager(Services, "Content");

            // Create a GameTimer to pump the XNA FrameworkDispatcher
            FrameworkDispatcherTimer = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();

            Settings = new Settings();
            AudioManager = new AudioManager(Settings.SoundEnabled, Settings.Volume / Settings.MaxVolume, Settings.MusicEnabled, Settings.Volume / Settings.MaxVolume);
            AudioManager.LoadSong("BasicDrumBeat", Content);
            AudioManager.LoadSong("ParticleFusion", Content);
            AudioManager.LoadSound("ClosedHihat", Content);
            AudioManager.LoadSound("Cymbal", Content);
            Leaderboard = new Leaderboard();
        }