private void IntroFinished()
 {
     if (introMusicInstance.State == SoundState.Stopped)
     {
         Tankontroller game = (Tankontroller)Tankontroller.Instance();
         game.ReplaceCurrentMusicInstance("Music/Music_loopable", true);
     }
 }
        public GameOverScene(Texture2D pBackgroundTexture, List <Player> pPlayers, int pWinner)
        {
            Tankontroller game = (Tankontroller)Tankontroller.Instance();

            mBackgroundTexture = pBackgroundTexture;
            mSpriteBatch       = new SpriteBatch(game.GDM().GraphicsDevice);
            int screenWidth  = game.GDM().GraphicsDevice.Viewport.Width;
            int screenHeight = game.GDM().GraphicsDevice.Viewport.Height;
            int height       = screenHeight / 2;
            int width        = (int)(mBackgroundTexture.Width * (float)height / mBackgroundTexture.Height);
            int x            = (screenWidth - width) / 2;
            int y            = (screenHeight - height) / 2;

            mRectangle   = new Rectangle(0, 0, screenWidth, screenHeight);
            mSecondsLeft = DGS.Instance.GetInt("SECONDS_TO_DISPLAY_GAMEOVER_SCREEN");
            game.ReplaceCurrentMusicInstance("Music/Music_start", true);
            mPlayers = pPlayers;
            mWinner  = pWinner;
            RepositionGUIs();
        }
Exemple #3
0
        public StartScene()
        {
            Tankontroller game = (Tankontroller)Tankontroller.Instance();

            mControllers = new List <IController>();
            mController0 = Tankontroller.Instance().Controller0();
            if (mController0 != null)
            {
                mControllers.Add(mController0);
            }
            mController1 = Tankontroller.Instance().Controller1();
            if (mController1 != null)
            {
                mControllers.Add(mController1);
            }
            mController2 = Tankontroller.Instance().Controller2();
            if (mController2 != null)
            {
                mControllers.Add(mController2);
            }
            mController3 = Tankontroller.Instance().Controller3();
            if (mController3 != null)
            {
                mControllers.Add(mController3);
            }



            mSpriteBatch = new SpriteBatch(game.GDM().GraphicsDevice);
            int screenWidth  = game.GDM().GraphicsDevice.Viewport.Width;
            int screenHeight = game.GDM().GraphicsDevice.Viewport.Height;

            mBackgroundTexture   = game.CM().Load <Texture2D>("background_01");
            mBackgroundRectangle = new Rectangle(0, 0, screenWidth, screenHeight);


            mForgroundTexture = game.CM().Load <Texture2D>("menu_white");

            mTitleTexture   = game.CM().Load <Texture2D>("menu_title");
            mTitleRectangle = new Rectangle((screenWidth / 2) - (644 / 2), (screenHeight / 2) - (128 / 2), 644, 128);

            mButtonList = new ButtonList();

            Texture2D startGameButtonTexture        = game.CM().Load <Texture2D>("menu_play_white");
            Texture2D startGameButtonTexturePressed = game.CM().Load <Texture2D>("menu_play_dark");

            Rectangle startGameButtonRectangle =
                new Rectangle(
                    ((int)((screenWidth - startGameButtonTexture.Width) / 2) - (int)(startGameButtonTexture.Width * 0.75f)),
                    (screenHeight) / 2 + startGameButtonTexture.Height,
                    startGameButtonTexture.Width,
                    startGameButtonTexture.Height);

            Button startGameButton = new Button(startGameButtonTexture, startGameButtonTexturePressed, startGameButtonRectangle, Color.Red, StartGame);

            startGameButton.Selected = true;
            mButtonList.Add(startGameButton);

            Texture2D exitGameButtonTexture        = game.CM().Load <Texture2D>("menu_quit_white");
            Texture2D exitGameButtonTexturePressed = game.CM().Load <Texture2D>("menu_quit_dark");

            Rectangle exitGameButtonRectangle =
                new Rectangle((screenWidth - exitGameButtonTexture.Width) / 2 + (int)(startGameButtonTexture.Width * 0.75f),
                              (screenHeight) / 2 + exitGameButtonTexture.Width,
                              exitGameButtonTexture.Width,
                              exitGameButtonTexture.Height);
            Button exitGameButton = new Button(exitGameButtonTexture, exitGameButtonTexturePressed, exitGameButtonRectangle, Color.Red, ExitGame);

            exitGameButton.Selected = false;
            mButtonList.Add(exitGameButton);
            mSecondsLeft = 0.1f;
            game.ReplaceCurrentMusicInstance("Music/Music_start", true);
        }
        // private Effect m_Shader;
        // private RenderTarget2D m_ShaderRenderTarget; // might not need this
        // private Texture2D m_ShaderTexture; // might not need this

        public GameScene()
        {
            Tankontroller game = (Tankontroller)Tankontroller.Instance();

            m_TankBaseTexture       = game.CM().Load <Texture2D>("Tank-B-05");
            m_TankBrokenTexture     = game.CM().Load <Texture2D>("BrokenTank");
            m_TankRightTrackTexture = game.CM().Load <Texture2D>("Tank track B-R");
            m_TankLeftTrackTexture  = game.CM().Load <Texture2D>("Tank track B-L");
            m_CannonTexture         = game.CM().Load <Texture2D>("cannon");
            m_CannonFireTexture     = game.CM().Load <Texture2D>("cannonFire");
            m_BulletTexture         = game.CM().Load <Texture2D>("circle");
            mPlayAreaTexture        = game.CM().Load <Texture2D>("playArea");
            mPixelTexture           = game.CM().Load <Texture2D>("block");
            TrackSystem.SetupStaticMembers(game.CM().Load <Texture2D>("track"));
            TeamGUI.SetupStaticTextures(
                game.CM().Load <Texture2D>("port1"),
                game.CM().Load <Texture2D>("port2"),
                game.CM().Load <Texture2D>("port3"),
                game.CM().Load <Texture2D>("port4"),
                game.CM().Load <Texture2D>("port5"),
                game.CM().Load <Texture2D>("port6"),
                game.CM().Load <Texture2D>("port7"),
                game.CM().Load <Texture2D>("port8"));

            JackIcon.SetupStaticTextures(
                game.CM().Load <Texture2D>("leftTrackForward"),
                game.CM().Load <Texture2D>("leftTrackBackwards"),
                game.CM().Load <Texture2D>("rightTrackForward"),
                game.CM().Load <Texture2D>("rightTrackBackwards"),
                game.CM().Load <Texture2D>("fire"),
                game.CM().Load <Texture2D>("charge"),
                game.CM().Load <Texture2D>("none"),
                game.CM().Load <Texture2D>("turretLeft"),
                game.CM().Load <Texture2D>("turretRight"));
            PowerBar.SetupStaticTextures(game.CM().Load <Texture2D>("powerBar_border"),
                                         game.CM().Load <Texture2D>("powerBar_power"));

            m_CircleTexture = game.CM().Load <Texture2D>("circle");

            m_SpriteBatch = new SpriteBatch(game.GDM().GraphicsDevice);

            /*m_Shader = game.CM().Load<Effect>("shader");
             * m_ShaderRenderTarget = new RenderTarget2D(game.GDM().GraphicsDevice,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferWidth,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferHeight);
             * m_ShaderTexture = new Texture2D(game.GDM().GraphicsDevice,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferWidth,
             *  game.GDM().GraphicsDevice.PresentationParameters.BackBufferHeight, false, m_ShaderRenderTarget.Format);
             */
            mBackgroundTexture        = game.CM().Load <Texture2D>("background_01");
            mBackgroundRectangle      = new Rectangle(0, 0, game.GDM().GraphicsDevice.Viewport.Width, game.GDM().GraphicsDevice.Viewport.Height);
            mPlayAreaRectangle        = new Rectangle(game.GDM().GraphicsDevice.Viewport.Width * 2 / 100, game.GDM().GraphicsDevice.Viewport.Height * 25 / 100, game.GDM().GraphicsDevice.Viewport.Width * 96 / 100, game.GDM().GraphicsDevice.Viewport.Height * 73 / 100);
            mPlayAreaOutlineRectangle = new Rectangle(mPlayAreaRectangle.X - 5, mPlayAreaRectangle.Y - 5, mPlayAreaRectangle.Width + 10, mPlayAreaRectangle.Height + 10);
            introMusicInstance        = game.ReplaceCurrentMusicInstance("Music/Music_intro", false);

            mController0 = Tankontroller.Instance().Controller0();
            mController1 = Tankontroller.Instance().Controller1();
            mController2 = Tankontroller.Instance().Controller2();
            mController3 = Tankontroller.Instance().Controller3();
            mController0.ResetJacks();
            mController1.ResetJacks();
            if (DGS.Instance.GetInt("NUM_PLAYERS") > 2)
            {
                mController2.ResetJacks();
                if (DGS.Instance.GetInt("NUM_PLAYERS") > 3)
                {
                    mController3.ResetJacks();
                }
            }

            //loopMusicInstance = game.GetSoundManager().GetLoopableSoundEffectInstance("Music/Music_loopable");  // Put the name of your song here instead of "song_title"
            // game.ReplaceCurrentMusicInstance("Music/Music_loopable", true);
            tankMoveSound = game.GetSoundManager().GetLoopableSoundEffectInstance("Sounds/Tank_Tracks");  // Put the name of your song here instead of "song_title"

            if (DGS.Instance.GetInt("NUM_PLAYERS") < 4)
            {
                setupNot4Player(mPlayAreaRectangle);
            }
            else
            {
                setup4Player(mPlayAreaRectangle);
            }
            foreach (Player p in m_Teams)
            {
                m_World.AddTank(p.Tank);
            }
        }