Пример #1
0
        protected override void Update(GameTime gameTime)
        {
            if (isInReplayMode)
            {
                if (gR == null)
                {
                    this.gR = new GamerReplayer(this);
                }
                gR.Update();
            }
            else
            {
                foreach (IController controller in controllerList)
                {
                    controller.Update(gameTime);
                }
            }

            if (editingLevel)
            {
                eld.Update(gameTime);
                this.IsMouseVisible = true;
            }
            else
            {
                if (notPaused)
                {
                    WorldManager.Update(gameTime);
                }

                if (isSpawning)
                {
                    EnSp.Update();
                }

                GameOver.Update(gameTime);
                RemainingLives.Update(gameTime);
                base.Update(gameTime);

                if (SoundManager.SoundLock1 == true)
                {
                    //set initial TimeSpan
                    SoundManager.Time       = gameTime.TotalGameTime;
                    SoundManager.SoundLock1 = false;
                }

                if (StarUtility.StarMarioLock == true)
                {
                    StarUtility.Time          = gameTime.TotalGameTime;
                    StarUtility.StarMarioLock = false;
                }
                sm.Update(gameTime);
                su.Update(gameTime);
                this.IsMouseVisible = false;
            }
        }
Пример #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.IsFullScreen              = false;
            graphics.PreferredBackBufferWidth  = 500;
            graphics.PreferredBackBufferHeight = 300;

            controllerList        = new ArrayList();
            defaultControllerList = new ArrayList();
            defaultControllerList.Add(new DefaultKeyboardController(this));
            defaultControllerList.Add(new GamepadController(this));

            levelControllerList = new ArrayList();
            levelEditingCamera  = new CameraController(this, new Vector2(0, 0), graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            levelControllerList.Add(new EditingKeyboardController(this, levelEditingCamera));

            jumpOnlyControllerList = new ArrayList();
            jumpOnlyControllerList.Add(new JumpOnlyKeyboardController(this));
            //Add mouse controller

            filename = "";
            if (!this.isInReplayMode)
            {
                swWriteFile = File.CreateText(strWriteFilePath);
            }
            else
            {
                this.gR = new GamerReplayer(this);
            }

            sm = new SoundManager();
            su = new StarUtility();

            Content.RootDirectory = "Content";

            SoundManager.LoadSoundContent(this);

            mainBGMInstance = mainBGM.CreateInstance();
            mainBGMInstance.Play();

            MarioUtility.SetSpriteSheetWidths();
            EnemySpriteUtility.SetSpriteSheetWidths();

            EnSp = new EnemySpawner();

            eld = new EditLevelDisplay();
            eld.Initialize(this, new Vector2(0, 0), levelEditingCamera, sm);
        }