Пример #1
0
        public PlayScreen(GameWrapper i_Game, bool i_TwoPlayers)
            : base(i_Game)
        {
            this.IsModal = true;
            this.BlendState = BlendState.NonPremultiplied;

            m_Game = i_Game;

            m_TwoPlayers = i_TwoPlayers;

            m_LoadingScreen = new LoadingScreen(i_Game, m_Level);
            m_PauseScreen = new PauseScreen(i_Game);
            m_GameOverScreen = new GameOverScreen(i_Game, new GameOverEventArgs(EventArgs.Empty));

            m_BackGround = new BackGround(this.Game as GameWrapper);
            m_BackGround.DrawOrder = 0;
            Add(m_BackGround);

            m_ShipsManager = new ShipsManager(i_Game, m_TwoPlayers);
            m_ShipsManager.DrawOrder = 10;
            m_ShipsManager.AlienHit += onGameOverRequested; // todo: if (*) is implemented then unsubscribe this
            m_ShipsManager.AllShipsDestroyed += onGameOverRequested;
            Add(m_ShipsManager);

            m_Enemies = new EnemyManager(i_Game);
            m_Enemies.DrawOrder = 10;
            m_Enemies.AliensReachedBottom += onGameOverRequested; // todo: (*) alien reached spaceships height, not bottom
            m_Enemies.AllAliensAreDead += onLevelWon;
            m_Enemies.AllAliensAreDead += playGameOverSound;
            Add(m_Enemies);

            m_ScoreBoard = new ScoreBoard(i_Game);
            m_ScoreBoard.DrawOrder = 20;
            Add(m_ScoreBoard);

            m_LivesDisplay = new LivesDisplay(i_Game);
            m_LivesDisplay.DrawOrder = 20;
            Add(m_LivesDisplay);

            m_BarriersManager = new BarriersManager(i_Game);
            m_ShipsManager.DrawOrder = 10;
            Add(m_BarriersManager);
        }
        public PlayScreen(Game i_Game)
            : base(i_Game)
        {
            r_Background = new Background(this, @"Sprites\BG_Space01_1024x768", 1f);
            r_PlayersManager = new PlayersManager(this);
            r_PlayersManager.AllPlayersDied += onGameLost;

            r_BarrierComposer = new BarrierComposer(this);
            r_MotherShipDeployer = new MotherShipDeployer(this);

            r_InvaderGrid = new InvaderGrid(this);
            r_InvaderGrid.InvaderReachedBottom += onGameLost;
            r_InvaderGrid.AllEnemiesDied += onAllEnemiesDied;

            r_PauseScreen = new PauseScreen(this);

            UseFadeTransition = true;
            BlendState = BlendState.NonPremultiplied;
            SpritesSortMode = SpriteSortMode.Deferred;
        }