コード例 #1
0
        private void InitLevel()
        {
            if (useDontDestroy)
            {
                DontDestroyOnLoad(this.gameObject);
            }

            mainMenu = MenuManager.Instance;
            gameMenu = MenuManager.Instance;

            if (!gameController)
            {
                gameController = GameController.Instance;
                gameController.SetLevelManager(this);

                gameData        = (GameData.DevScripts.GameData)gameController.GameData.Data;
                gameLogicScript = (GameLogicScript)gameController.GameLogicScript.Script;

                timeManager.controlEvent.AddListener(playFieldManager.MobileControl);
                timeManager.dropEvent.AddListener(playFieldManager.ObjectMoveDown);
                timeManager.reduceDropEvent.AddListener(ReduceDropStep);
                timeManager.waveChangeEvent.AddListener(ChangeWave);

                playFieldManager.updateNextDropObjectListEvent += dropObjectManagerUi.SetDropObjectList;
                playFieldManager.SetDestroyRayCountListener(CatchLevelReward);
                playFieldManager.LoseLifeEvent += LoseLife;

                if (gameController.MenuAndLevelsDivided)
                {
                    RunLevel(gameData.ActiveLevel);
                }
            }
        }
コード例 #2
0
        private void Start()
        {
            gameController = GameController.Instance;
            levelManager   = LevelManager.Instance;

            gameDate      = (GameData.DevScripts.GameData)gameController.GameData.Data;
            playerManager = LevelManager.Instance.PlayerManager;

            objectPool = ObjectPool.GetPoolByName("ObjectPoints");

            playField = new PlayField(size);

            // define events
            playField.DestroyLineEvent += LineDestroy;
            playField.DropLineEvent    += LineDrop;

            playField.CreateObjectEvent += ObjectCreate;
            playField.ChangeObjectEvent += ObjectUpdate;
            playField.FixObjectEvent    += ObjectFix;

            playField.CantCreateObjectEvent += CannotCreateDropObject;
        }