Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Paused = false;
            //Initialize each argument before sending it to contentloader
            //Controller initialization
            keyboardController  = new KeyboardController();
            keyboardController2 = new KeyboardController();
            gamePadController   = new GamePadController();

            keyboardController2.AddCommand((char)Keys.P, new PauseUnpauseGameCommand(this));
            keyboardController2.AddCommand((char)Keys.Q, new QuitCommand(this));
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch  = new SpriteBatch(GraphicsDevice);
            spriteMaster = new SpriteMaster(new SpriteBatch(GraphicsDevice), new SpriteBatch(GraphicsDevice));
            //Collision initialization
            collisionGrid = new CollisionGrid();
            //Load font
            font = Content.Load <SpriteFont>("Font");
            //load hud
            hud = new HUD(GraphicsDevice, font);

            //New Contentloader method should make Game1 easier to follow.
            ContentLoader contentLoader = new ContentLoader(Content, GraphicsDevice, this, graphics, spriteMaster, keyboardController, gamePadController, collisionGrid, hud);

            contentLoader.LoadGameContents(checkpointCoords);
            //this.camera = contentLoader.GetCamera();
            this.spriteMaster = contentLoader.GetSpriteMaster();
        }
Пример #2
0
        public void ResetGame()
        {
            if (hud.Lives > 0)
            {
                spriteBatch.Dispose();
                spriteMaster.Dispose();
                collisionGrid = null;

                keyboardController = new KeyboardController();
                gamePadController  = new GamePadController();

                // Create a new SpriteBatch, which can be used to draw textures.
                spriteBatch  = new SpriteBatch(GraphicsDevice);
                spriteMaster = new SpriteMaster(new SpriteBatch(GraphicsDevice), new SpriteBatch(GraphicsDevice));
                //Collision initialization
                collisionGrid = new CollisionGrid();

                //New Contentloader method should make Game1 easier to follow.
                ContentLoader contentLoader = new ContentLoader(Content, GraphicsDevice, this, graphics, spriteMaster, keyboardController, gamePadController, collisionGrid, hud);
                contentLoader.LoadGameContents(this.checkpointCoords, hud.Points, hud.Coins, hud.Lives);
                //this.camera = contentLoader.GetCamera();
                this.spriteMaster = contentLoader.GetSpriteMaster();
            }
            else
            {
                gameIsOver = true;
            }
        }
Пример #3
0
    public SpriteMaster()
    {
        Self.AssertNull();
        Self = this;

        Garbage.EnterNonInteractive();

        //SteamHelper.Init();

        MemoryMonitor = new();

        var assemblyPath = Assembly.Location;

        assemblyPath = Path.GetDirectoryName(assemblyPath);

        // Compress our own directory
        if (assemblyPath is not null)
        {
            DirectoryExt.CompressDirectory(assemblyPath, force: true);
        }
    }