void Init() { float totalItem = 0; foreach (Level lvl in zone.levels) { totalItem += lvl.findItem; } textItem.text = totalItem + "/" + zone.itemGoal; string idZone = zone.zoneName; idZone = idZone.Substring(4); int id = 0; int.TryParse(idZone, out id); if (id > 1) { string prevZoneName = "Zone" + (id - 1); Zone prevZone = new Zone(); if (ZoneData.GetZoneData(prevZoneName) != null) { prevZone = (ZoneData.GetZoneData(prevZoneName)); } if (prevZone.missionComplete) { zone.unlockedZone = true; } ZoneData.UpdateZoneData(zone); zone = (ZoneData.GetZoneData(zoneSettings.zone.zoneName)); } if (zone.unlockedZone) { GetComponent <Image>().color = Color.white; } }
IEnumerator WaitShowGameScore() { yield return(new WaitForSeconds(0.25f)); if (levelSettings.isTutorial) { itemPickSize = 3; } switch (itemPickSize) { case 1: starAnimator.SetTrigger("1Star"); if (!levelSettings.level.levelComplete && (itemPickSize > levelSettings.level.findItem)) { levelSettings.level.findItem = 1; playerProfile.playerCoin += levelSettings.starA; } break; case 2: starAnimator.SetTrigger("2Star"); if (!levelSettings.level.levelComplete && (itemPickSize > levelSettings.level.findItem)) { levelSettings.level.findItem = 2; playerProfile.playerCoin += levelSettings.starB; } break; case 3: starAnimator.SetTrigger("3Star"); levelSettings.level.findItem = 3; if (!levelSettings.level.levelComplete) { playerProfile.playerCoin += levelSettings.starC; } levelSettings.level.levelComplete = true; break; } for (int x = 0; x < zone.levels.Count; x++) { if (zone.levels[x].levelName == levelSettings.refLevelScene) { zone.levels[x] = levelSettings.level; if (itemPickSize > 0) { if ((x + 1) < zone.levels.Count) { zone.levels[x + 1].Unlocked = true; } } } int sumFindItem = 0; sumFindItem += zone.levels[x].findItem; if (sumFindItem >= zone.itemGoal) { zone.missionComplete = true; } } ZoneData.UpdateZoneData(zone); PlayerData.UpdatePlayerProfile(playerProfile); totalCoin.GetComponent <Text>().text = playerProfile.playerCoin.ToString(); }