// TODO: Check which crystals are already collected and populate accordingly. void Start() { ggm = GlobalGameManager.instance; lc = GameObject.Find("LevelController").GetComponent <LevelController>(); rluiController = GameObject.Find("UI").GetComponent <RLUIController>(); pfd = GameObject.Find("GlobalGameManager/PlayFabController/PlayFabDataController").GetComponent <PlayFabData>(); completionRewards = GameObject.Find("GlobalGameManager/LevelData/Completion").GetComponent <RewardGroup>(); firstTimeRewards = GameObject.Find("GlobalGameManager/LevelData/FirstTime").GetComponent <RewardGroup>(); masteryRewards = GameObject.Find("GlobalGameManager/LevelData/Mastery").GetComponent <RewardGroup>(); levelLength = ggm.GetLevelLength(); spellMultiplier = ggm.GetSpellMultiplier(); spellMultiplierCap = ggm.GetSpellMultiplierCap(); speedMultiplierCap = ggm.GetMaxSpeedBonus(); maxSpeed = ggm.GetMaxVelocity(); scoreMarks = ggm.GetScoreMarks(); scoreCap = ggm.GetScoreCap(); freeMovement = ggm.GetFreeMovement(); levelName = ggm.GetLevelName(); if (freeMovement) { levelTime = 0; } levelPerformance = ggm.GetLevelPerformance(); if (levelPerformance == null) { levelPerformance = string.Empty; } if (levelPerformance.Contains("R")) { rluiController.OnCrystal("Red"); lc.CollectRedCrystal(); OnCrystalCollect("Red"); } if (levelPerformance.Contains("G")) { rluiController.OnCrystal("Green"); lc.CollectGreenCrystal(); OnCrystalCollect("Green"); } if (levelPerformance.Contains("B")) { rluiController.OnCrystal("Blue"); lc.CollectBlueCrystal(); OnCrystalCollect("Blue"); } StartCoroutine(GetCompletionData()); }