Пример #1
0
        public void CreatePanelUIZone()
        {
            foreach (Transform t in parentUIPanelLevel)
            {
                Destroy(t.gameObject);
            }

            for (int x = 0; x < stageManager.listStages.Count; x++)
            {
                StageData  currentStageData = StageSave.GetStageData(stageManager.listStages[x].zone.zoneName);
                GameObject newPanel         = Instantiate(stageManager.prefabPanelZone);

                if (stageManager.listStages[x].zone.isCommingSoon)
                {
                    newPanel.GetComponent <UIPanelZone>().InitUIPanelZone(stageManager.listStages[x]);
                }
                else
                {
                    Stage stage = ScriptableObject.CreateInstance(typeof(Stage)) as Stage;
                    stage.spriteLocked      = stageManager.listStages[x].spriteLocked;
                    stage.spriteUnlocked    = stageManager.listStages[x].spriteUnlocked;
                    stage.spriteCommingSoon = stageManager.listStages[x].spriteCommingSoon;
                    stage.zone   = currentStageData.zone;
                    stage.levels = currentStageData.levels;

                    newPanel.GetComponent <UIPanelZone>().InitUIPanelZone(stage);
                }


                newPanel.transform.SetParent(parentUIPanelZone);
                newPanel.transform.localScale = Vector3.one;
            }
        }
Пример #2
0
        public void DebugSaveLevelData()
        {
            DebugSaveZoneData();

            if (currentLevel.levelStar > 2)
            {
                currentLevel.isCompleted = true;
            }

            StageData currentStageData = StageSave.GetStageData(currentZone.zoneName);

            if (currentStageData == null)
            {
                return;
            }

            for (int i = 0; i < currentStageData.levels.Count; i++)
            {
                //CURRENT LEVEL
                if (currentStageData.levels[i].ID == currentLevel.ID)
                {
                    if (currentLevel.levelStar > 0)
                    {
                        //IF STAR COUNT BLA BLA BLA
                        if (currentLevel.levelStar > currentStageData.levels[i].levelStar)
                        {
                            currentZone.zoneStarSaved = (currentZone.zoneStarSaved - currentStageData.levels[i].levelStar) + currentLevel.levelStar;
                        }

                        currentStageData.zone      = currentZone;
                        currentStageData.levels[i] = currentLevel;

                        //NEXT LEVEL UNLOCK
                        int index = i + 1;
                        if (index < currentStageData.levels.Count)
                        {
                            currentStageData.levels[index].isUnlocked = true;
                        }


                        StageSave.UpdateStageData(currentStageData);
                    }
                }
            }
        }
Пример #3
0
        public void DebugSaveZoneData()
        {
            if (currentZone.zoneStarSaved >= currentZone.zoneStarGoal)
            {
                currentZone.isCompleted = true;
            }

            StageData nextStageData = StageSave.GetStageData("Zone" + (currentZone.ID + 1));

            if (nextStageData == null)
            {
                return;
            }

            if (currentZone.isCompleted)
            {
                nextStageData.zone.isUnlocked = true;
                StageSave.UpdateStageData(nextStageData);
            }
        }