示例#1
0
 public static void HideScreen()
 {
     if (_currentActiveScreen != null)
     {
         Time.timeScale = 1.0f;
         _currentActiveScreen.Hide();
         BlackScreen.Hide();
     }
     else
     {
         Debug.LogException(new System.Exception("Вызов функции скрытия Screen, когда ни один из них не показан"));
     }
 }
示例#2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch        = new SpriteBatch(GraphicsDevice);
            fntForPauseOrDeath = Content.Load <SpriteFont>("FntForPauseOrDeath");
            blkScrn            = new BlackScreen(Content.Load <Texture2D>(BlackScreen.textureName));
            blkScrn.Hide();
            allMenuObjects.Add(blkScrn);
            bckgrnd = new Background(Content.Load <Texture2D>("background"), Content.Load <Texture2D>("background"), GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, allNotMenuObjects);
            List <Texture2D> mrioFacingRightTextures = new List <Texture2D>();
            List <Texture2D> mrioFacingLeftTextures  = new List <Texture2D>();

            foreach (string assetName in Mario.texturesNameFacingRight)
            {
                mrioFacingRightTextures.Add(Content.Load <Texture2D>(assetName));
            }
            foreach (string assetName in Mario.texturesNameFacingLeft)
            {
                mrioFacingLeftTextures.Add(Content.Load <Texture2D>(assetName));
            }
            Floor        flr        = new Floor(bckgrnd.GameWidth, bckgrnd.GameHeight);
            Texture2D    hrtTexture = Content.Load <Texture2D>(Heart.textureName);
            List <Heart> hrts       = new List <Heart>();

            hrts.Add(new Heart(hrtTexture, 10));
            hrts.Add(new Heart(hrtTexture, hrts[0].Right + 5));
            hrts.Add(new Heart(hrtTexture, hrts[1].Right + 5));
            mrioStrategy = new UserMarioMovingStrategy();
            mrio         = new Mario(mrioFacingRightTextures, mrioFacingLeftTextures, flr, mrioStrategy, hrts);
            allNotMenuObjects.Add(flr);

            Pipe pip = new Pipe(Content.Load <Texture2D>(Pipe.textureName), 800, 0.7f);

            allNotMenuObjects.Add(pip);

            foreach (Heart hrt in hrts)
            {
                allNotMenuObjects.Add(hrt);
            }

            crtr = new GameObjsCreator(pip, flr, this, mrio);
            HugeCannonBomb cnnBmbHuge = crtr.CreateHugeCannonBomb();

            if (cnnBmbHuge != null)
            {
                allNotMenuObjects.Add(cnnBmbHuge);
            }
            List <Texture2D> gmbaFacingRightTextures = new List <Texture2D>();
            List <Texture2D> gmbaFacingLeftTextures  = new List <Texture2D>();

            foreach (string assetName in Goomba.texturesNameFacingRight)
            {
                gmbaFacingRightTextures.Add(Content.Load <Texture2D>(assetName));
            }
            foreach (string assetName in Goomba.texturesNameFacingLeft)
            {
                gmbaFacingLeftTextures.Add(Content.Load <Texture2D>(assetName));
            }
            Texture2D gmbaDeadTxtr        = Content.Load <Texture2D>(Goomba.deadTextureNm);
            Texture2D gmbaDeadTxtrFlipped = Content.Load <Texture2D>(Goomba.deadTextureFlippedNm);
            Goomba    gmba = new Goomba(gmbaFacingRightTextures, gmbaFacingLeftTextures, flr, 500, new RandomLeftRightStay(), gmbaDeadTxtr, gmbaDeadTxtrFlipped, mrio.Points);

            allNotMenuObjects.Add(mrio);
            allNotMenuObjects.Add(gmba);
            List <GameObject> invntryStrip = crtr.CreateInventoryStrip(bckgrnd.GameWidth);

            for (int i = 1; i < invntryStrip.Count; i++)
            {
                mrioInventoryCells.Add(invntryStrip[i] as ItemCell);
            }
            allMenuObjects.AddRange(invntryStrip);
            chestStrip = crtr.CreateChestInvStrip(bckgrnd.GameWidth, bckgrnd.GameHeight);
            for (int i = 1; i < chestStrip.Count; i++)
            {
                chestWpnsCells[i - 1] = chestStrip[i] as ItemCell;
            }
        }