예제 #1
0
        public Level1(Game game, SpriteBatch spriteBatch, Texture2D image, ConfiguraNaves _configuranaves)
            : base(game, spriteBatch)
        {
            this.image     = image;
            imageRectangle = new Rectangle(
                0,
                0,
                Game.Window.ClientBounds.Width,
                Game.Window.ClientBounds.Height);

            posicaoNavesSelecionadas    = new Vector2[2];
            posicaoNavesSelecionadas[0] = new Vector2(700, 100);
            posicaoNavesSelecionadas[1] = new Vector2(700, 400);

            configuranaves = _configuranaves;

            naves = new Texture2D[2];

            acabouJogo = false;

            Initialize();
        }
        /// <summary>
        /// Carga inicial dos elementos e resources do jogo
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            menuinicial = new MenuInicial(
                this,
                spriteBatch,
                Content.Load <SpriteFont>("Tela/menufont"),
                Content.Load <Texture2D>("Tela/01_menu"));
            comandosp1 = Content.Load <Texture2D>("imagens/posp1");
            comandosp2 = Content.Load <Texture2D>("imagens/posp2");
            somtiro    = Content.Load <SoundEffect>("audios/somtiro");
            rocket     = Content.Load <SoundEffect>("audios/rocket");
            colisao    = Content.Load <SoundEffect>("audios/colisao");
            explode    = Content.Load <SoundEffect>("audios/explode");
            flare      = Content.Load <SoundEffect>("audios/flare");
            musica     = Content.Load <Song>("audios/musica");

            Components.Add(menuinicial);
            menuinicial.Hide();

            configuranaves = new ConfiguraNaves(
                this,
                spriteBatch,
                Content.Load <Texture2D>("Tela/02_telaEscolha"));
            Components.Add(configuranaves);
            configuranaves.Hide();

            level1 = new Level1(
                this,
                spriteBatch,
                Content.Load <Texture2D>("Tela/03_jogo"),
                configuranaves);
            Components.Add(level1);
            level1.Hide();

            activeScreen = menuinicial;
            activeScreen.Show();
        }