Example #1
0
        void Start()
        {
            if (gMode == GameMode.Edit)
            {
                Debug.Log("start edit mode");
#if UNITY_EDITOR
                CreateGameBoard(true);
                gConstructor.GetComponent <GameConstructor>().InitStart();
                if (anchor)
                {
                    anchor.gameObject.SetActive(false);
                }
#endif
            }

            else if (gMode == GameMode.Play)
            {
                Debug.Log("start play mode");
                CreateGameBoard(true);
                if (gConstructor)
                {
                    DestroyImmediate(gConstructor.gameObject);
                }
                BubblesShooter.Instance.InitStart(minBubbleScore, maxBubbleScore);
                MPlayer.SetAverageScore(grid.GetObjectCountWithScore() * (minBubbleScore + maxBubbleScore) / 2);
                Debug.Log("AverageScore: " + BubblesPlayer.Instance.AverageScore);
                WController = new WinController(LcSet.levelMission, this, BubblesShooter.Instance,
                                                () =>
                {
                    // BubblesPlayer.Instance.PassLevel();
                    // GuiController.Instance.ShowVictory();// next features
                },
                                                () =>
                {
                    // next features
                    // BubblesPlayer.Instance.AddLifes(-1);
                    // GuiController.Instance.ShowLoss();
                },
                                                () => { if (HeaderGUIController.Instance)
                                                        {
                                                            HeaderGUIController.Instance.RefreshTargets();
                                                        }
                                                },
                                                timeCounter, movesCounter);

                if (showLevelMission)
                {
                    MGui.ShowMission(() => { Debug.Log("close mission"); });
                }
                if (HeaderGUIController.Instance)
                {
                    HeaderGUIController.Instance.Refresh();
                }
            }

            FooterGUIController.Instance.InitStart();
            resultShowed = false;
        }
Example #2
0
 public void RefreshTimeMoves()
 {
     if (MatchBoard.GMode == GameMode.Edit)
     {
         MissionConstruct mc = MBoard.LcSet.levelMission;
         if (MovesCountText)
         {
             MovesCountText.text = mc.MovesConstrain.ToString();
         }
         if (TimerText)
         {
             TimerText.text = mc.TimeConstrain.ToString();
         }
         if (MovesBlock)
         {
             MovesBlock.SetActive(!mc.IsTimeLevel);
         }
         if (TimerBlock)
         {
             TimerBlock.SetActive(mc.IsTimeLevel);
         }
     }
     else
     {
         WinController winContr = MBoard.WinContr;
         if (!winContr.IsTimeLevel)
         {
             if (MovesCountText)
             {
                 MovesCountText.text = winContr.MovesRest.ToString();
             }
         }
         else
         {
             if (TimerText)
             {
                 TimerText.text = winContr.TimeRest.ToString();
             }
         }
     }
 }
Example #3
0
        private void Start()
        {
            CreateTargets();

            // set event handlers
            if (MatchBoard.GMode == GameMode.Play)
            {
                Refresh();
                MPlayer.ChangeScoreEvent += RefreshScoreStrip;
                MPlayer.ChangeStarsEvent += RefreshStars;
                MPlayer.ChangeStarsEvent += GetStarsSound;

                WinController winContr = MBoard.WinContr;
                if (MovesBlock)
                {
                    MovesBlock.SetActive(!winContr.IsTimeLevel);
                }
                if (TimerBlock)
                {
                    TimerBlock.SetActive(winContr.IsTimeLevel);
                }

                if (!winContr.IsTimeLevel)
                {
                    winContr.ChangeMovesEvent += (int m) => { if (MovesCountText)
                                                              {
                                                                  MovesCountText.text = m.ToString();
                                                              }
                    };
                }
                else
                {
                    winContr.TimerTickEvent += (float t) => { if (TimerText)
                                                              {
                                                                  TimerText.text = t.ToString();
                                                              }
                    };
                }
            }
        }
        public override void RefreshWindow()
        {
            LevelConstructSet lCS   = GameBoard.LcSet;
            MissionConstruct  lM    = lCS.levelMission;
            LevelType         lType = lM.GetLevelType();

            int           time  = lM.TimeConstrain;
            int           moves = lM.MovesConstrain;
            int           level = BubblesPlayer.CurrentLevel + 1;
            WinController wC    = GameBoard.Instance.WController;

            if (descriptionText)
            {
                descriptionText.text = lM.Description;
            }

            if (levelNumberText)
            {
                levelNumberText.text = level.ToString();
            }

            if (TimeLevelGO)
            {
                TimeLevelGO.SetActive(lType == LevelType.TimeLevel);
            }
            if (FishLevelGO)
            {
                FishLevelGO.SetActive(lType == LevelType.FishLevel);
            }
            if (AnchorLevelGO)
            {
                AnchorLevelGO.SetActive(lType == LevelType.AnchorLevel);
            }
            if (LoopTopRowLevelGO)
            {
                LoopTopRowLevelGO.SetActive(lType == LevelType.LoopTopRowLevel);
            }

            switch (lType)
            {
            case LevelType.LoopTopRowLevel:
                if (bubblesCountText)
                {
                    bubblesCountText.text = "x " + wC.TopRowBubblesCountToCollect;
                }
                break;

            case LevelType.TimeLevel:
                if (timeLimitText)
                {
                    timeLimitText.text = "x " + time;
                }
                break;

            case LevelType.AnchorLevel:
                if (anchorCountText)
                {
                    anchorCountText.text = "x " + 1;
                }
                break;

            case LevelType.FishLevel:
                int fishCount          = 0;
                int fishCountCollected = 0;
                wC.GetCurrTarget(out fishCountCollected, out fishCount);
                if (targetCountText)
                {
                    targetCountText.text = "x " + fishCount;
                }
                break;
            }
            base.RefreshWindow();
        }