示例#1
0
        public void CompleteLevel()
        {
            currentPlayData.config.levelIndex++;

            if (currentPlayData.config.levelIndex > currentPlayData.config.levelCount - 1)
            {
                currentPlayData.config.levelIndex = currentPlayData.config.levelCount - 1;
                currentPlayData.config.completed  = true;

                previousPlayData        = currentPlayData;
                previousPlayData.config = currentPlayData.CloneConfig();

                playDataIndex++;
                if (playDataIndex > playDataList.Count - 1)
                {
                    playDataIndex = playDataList.Count - 1;
                    gameComplete  = true;
                }

                if (!gameComplete)
                {
                    currentPlayData = GetCurrentPlayData();
                    currentPlayData.config.unlocked      = true;
                    currentPlayData.config.moveCount    += previousPlayData.config.moveCount;
                    currentPlayData.config.zenModeCount += previousPlayData.config.zenModeCount;
                }
            }
        }
示例#2
0
        public PlayData GetCurrentPlayData()
        {
            currentPlayData  = playDataList[playDataIndex];
            currentLevelType = currentPlayData.config.levelType;

            return(currentPlayData);
        }
示例#3
0
        public void Init(PlayData pPlayData)
        {
            playData = pPlayData;

            UpdateMoves();
            UpdateZenCount();
            UpdateLevelsText();
        }
示例#4
0
        public void Init(GameData pGameData)
        {
            gameData = pGameData;

            // ---
            PlayData levelLearnerData = gameData.playDataList[0];
            learnerLevelController.OnClicked += OnSelectionLevelClicked;
            learnerLevelController.EnableInput(false);
            
            if (levelLearnerData.config.unlocked)
            {
                learnerLevelController.UpdateLevelIndex(levelLearnerData.config.levelIndex, levelLearnerData.config.levelCount);
                learnerLevelController.UnlockLevelArea();
                learnerLevelController.EnableInput(true);

                if (levelLearnerData.config.completed)
                {
                    learnerLevelController.CompleteLevelArea();
                    learnerLevelController.EnableInput(false);
                }
            }

            // ---
            PlayData levelMovementData = gameData.playDataList[1];
            movementLevelController.OnClicked += OnSelectionLevelClicked;
            movementLevelController.EnableInput(false);
            
            if (levelMovementData.config.unlocked)
            {
                movementLevelController.UpdateLevelIndex(levelMovementData.config.levelIndex, levelMovementData.config.levelCount);
                movementLevelController.UnlockLevelArea();
                movementLevelController.EnableInput(true);

                if (levelMovementData.config.completed)
                {
                    movementLevelController.CompleteLevelArea();
                    movementLevelController.EnableInput(false);
                }
            }

            focusLevelController.OnClicked += OnFocusLevelClicked;
            focusLevelController.EnableInput(false);

            awarenessLevelController.OnClicked += OnAwarenessLevelClicked;
            awarenessLevelController.EnableInput(false);

            masteryLevelController.OnClicked += OnMasteryLevelClicked;
            masteryLevelController.EnableInput(false);

            fadePanelController.OnFadeComplete += OnFadeOutComplete;
            fadePanelController.FadeOut();
        }
示例#5
0
        private void Awake()
        {
            playData = gameData.GetCurrentPlayData();

            levelSystem = FindObjectOfType <LevelSystem>();
            levelSystem.Init(playData);

            hudController = FindObjectOfType <HUDController>();
            hudController.Init(playData);

            transitionSystem = FindObjectOfType <TransitionSystem>();
            transitionSystem.OnFadeComplete += OnTransitionEnterComplete;
            transitionSystem.Init();
            transitionSystem.PlayEnterTransition();
        }
示例#6
0
        public void Init(PlayData pPlayData)
        {
            playData = pPlayData;

            // Instantiate level prefab using level data
            GameObject levelObject = Instantiate(playData.levelPrefabs[playData.config.levelIndex]);

            // Set levelTransform to the instansiated prefab
            config.levelTransform = levelObject.transform;

            // Populate level
            int playerCount = 0;
            int boxCount    = 0;
            int wallCount   = 0;
            int gateCount   = 0;
            int switchCount = 0;
            int goalIndex   = 0;

            foreach (Transform t in config.levelTransform)
            {
                Vector3 pos = t.position;

                if (t.GetComponent <Player>() != null)
                {
                    Player player = t.GetComponent <Player>();
                    player.Load(playerCount, pos);

                    config.players.Add(player);

                    playerCount++;
                }

                if (t.GetComponent <Box>() != null)
                {
                    Box box = t.GetComponent <Box>();
                    box.Load(boxCount, pos);

                    config.boxes.Add(box);

                    boxCount++;
                }

                if (t.GetComponent <Wall>() != null)
                {
                    Wall wall = t.GetComponent <Wall>();
                    wall.Load(wallCount, pos);

                    config.walls.Add(wall);

                    wallCount++;
                }

                if (t.GetComponent <Exit>() != null)
                {
                    Exit exit = t.GetComponent <Exit>();
                    exit.Load(goalIndex, pos);

                    config.exits.Add(exit);

                    goalIndex++;
                }

                if (t.GetComponent <Gate>() != null)
                {
                    Gate gate = t.GetComponent <Gate>();
                    gate.Load(gateCount, pos);

                    config.gates.Add(gate);

                    gateCount++;
                }

                if (t.GetComponent <Switch>() != null)
                {
                    Switch sw = t.GetComponent <Switch>();
                    sw.Load(switchCount, pos);

                    config.switches.Add(sw);

                    switchCount++;
                }
            }
        }