public GamePlayScreen(IGameScreenManager screenManager, IGestureManager gm)
            : base(screenManager)
        {
            gameBoard = new PZBoard(9, 4, objectManager);
            gameBoard.Board = new int[,] {
                {0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0}
            };

            this.gm = gm;

            this.playBacground = new PlayBackground(this.Game, SCSServices.Instance.ResourceManager.GetResource<Texture2D>(backgroundNames[GRandom.RandomInt(backgroundNames.Length)]));
            ResetGame(0);
        }
        public GamePlayScreen(IGameScreenManager screenManager, IGestureManager gm, PvZGrowSystem growSys)
            : base(screenManager, "PlayScreen")
        {
            gameBoard = new PZBoard(9, 4, objectManager);
            gameBoard.Board = new int[,] {
                {0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0}
            };

            this.gm = gm;
            level = PZLevelManager.Instance.GetLevel();
            level.OnBeginWave += level_OnBeginWave;
            this.playBacground = new PlayBackground(this.Game, SCSServices.Instance.ResourceManager.GetResource<Texture2D>(level.Background));
            this.playBacground.Initialize();
            this.playBacground.OnAnimatingCompleted += this.OnBackgroundAnimatingCompleted;
            this.playBacground.StartAnimate();

            _messageCenter = new MessageCenter(this.Game);

            this.growSystem = growSys;
        }
 private void OnBackgroundAnimatingCompleted(PlayBackground background)
 {
     this.state = PlayState.SELECT_LEVEL;
     this.InitGamePlay();
 }
 private void OnBackgroundAnimatingCompleted(PlayBackground background)
 {
     this.state = PlayState.RUNNING;
     this.InitGamePlayAtLevel();
 }
        public void ResetGame(int _level)
        {
            m_level = _level;
            this.playBacground = new PlayBackground(this.Game, SCSServices.Instance.ResourceManager.GetResource<Texture2D>(@"Images\Controls\Background_Forest"));
            this.playBacground.Initialize();
            this.playBacground.OnAnimatingCompleted += this.OnBackgroundAnimatingCompleted;
            this.playBacground.StartAnimate();

            // Clear
            PZObjectManager.Instance.RemoveAll();
        }