Esempio n. 1
0
        public void Initialize(Game game)
        {
            if (this.player != null)
            {
                MouseManager.GetInstance().mouseClickedListeners -= this.player.OnMouseClick;
                MouseManager.GetInstance().mouseReleasedListeners -= this.player.OnMouseRelease;

                MouseManager.GetInstance().mouseClickedListeners -= this.player.paw.OnMouseClick;
                MouseManager.GetInstance().mouseReleasedListeners -= this.player.paw.OnMouseRelease;

                MouseManager.GetInstance().mouseMotionListeners -= this.player.paw.OnMouseMotion;
                MouseManager.GetInstance().mouseDragListeners -= this.player.paw.OnMouseDrag;

                GameTimeManager.GetInstance().OnStartUpdate();
                GameTimeManager.GetInstance().previousUpdateStartMS = GameTimeManager.GetInstance().currentUpdateStartMS;
            }

            this.game = game;
            AudioManager = new AudioManager();
            AudioManager.PlayAmbientBackGroundMusic();
            ParticleManager.DEFAULT_TEXTURE = this.game.Content.Load<Texture2D>("Particles/default");
            this.player = new Player();
            board = new Board(4, 3);

            StateManager.GetInstance().SetState(StateManager.State.Running);
        }
Esempio n. 2
0
        /// <summary>
        /// Restarts the game.
        /// </summary>
        public void RestartGame()
        {
            board = null;
            player = null;
            StateManager.GetInstance().SetState(StateManager.State.Running);

            this.Initialize(this.game);
        }