Exemplo n.º 1
0
    private void Reset()
    {
        if (cubeController != null)
        {
            cubeController.Reset();
            cubeController = null;
        }
        if (elementsController != null)
        {
            elementsController.Reset();
            elementsController = null;
        }
        if (playerModel != null)
        {
            playerModel.Reset();
            playerModel = null;
        }
        if (gameStateModel != null)
        {
            gameStateModel.Reset();
            gameStateModel = null;
        }
        if (gameStateModel != null)
        {
            gameStateModel.Reset();
            gameStateModel = null;
        }

        RemoveEventListeners();
    }
Exemplo n.º 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);
            interactables = new HashSet <IInteractable>();
            controller    = new CubeController(
                new Cube("yrYrgygYgo yoYobybYbr Rgo Obr wrWrgwgWgo woWobwbWbr"),
                new CubeView(),
                this);
            controller.Locate(new Vector2(100, 200));
            // controller.Scramble(50);

            ThreeStageButton scramble_button = new ThreeStageButton(
                Content.Load <Texture2D>("Pieces/scramble-button-1"),
                Content.Load <Texture2D>("Pieces/scramble-button-2"),
                Content.Load <Texture2D>("Pieces/scramble-button-3"),
                () => controller.Scramble(30, true));

            ThreeStageButton reset_button = new ThreeStageButton(
                Content.Load <Texture2D>("Pieces/reset-button-1"),
                Content.Load <Texture2D>("Pieces/reset-button-2"),
                Content.Load <Texture2D>("Pieces/reset-button-3"),
                () => controller.Reset()
                );;

            scramble_button.Locate(new Vector2(25, 500 - 13));
            reset_button.Locate(new Vector2(175, 500 - 13));

            interactables.Add(scramble_button);
            interactables.Add(reset_button);
            interactables.Add(controller);

            font = Content.Load <SpriteFont>("MarioFont");

            // TODO: use this.Content to load your game content here
        }