/// <summary> /// Increments one of the StepRecords that can unlock Achievements. /// </summary> /// <param name="stepType">The eStepType to increment.</param> /// <param name="num">The amount to increment (default = 1).</param> static public void AchievementStep(Achievement.eStepType stepType, int num = 1) { StepRecord sRec = STEP_REC_DICT[stepType]; if (sRec != null) { sRec.Progress(num); // Iterate through all of the possible Achievements and see if the step // completes the Achievement foreach (Achievement ach in S.achievements) { if (!ach.complete) { // Pass the step information to the Achievement, to see if it is completed if (ach.CheckCompletion(stepType, sRec.num)) { // The result is true if the Achievement was newly completed AnnounceAchievementCompletion(ach); // Tell Unity Analytics that the Achievement has been completed CustomAnalytics.SendAchievementUnlocked(ach); // Also save the game any time we complete an Achievement SaveGameManager.Save(); } } } } else { Debug.LogWarning("AchievementManager:AchievementStep( " + stepType + ", " + num + " )" + "was passed a stepType that is not in STEP_REC_DICT."); } }
/// <summary> /// Increments one of the StepRecords that can unlock Achievements. /// </summary> /// <param name="stepType">The eStepType to increment.</param> /// <param name="num">The amount to increment (default = 1).</param> static public void AchievementStep(Achievement.eStepType stepType, int num = 1) { StepRecord sRec = STEP_REC_DICT[stepType]; if (sRec != null) { sRec.Progress(num); // Iterate through all of the possible Achievements and see if the step // completes the Achievement foreach (Achievement ach in S.achievements) { if (!ach.complete) { // Pass the step information to the Achievement, to see if it is completed if (ach.CheckCompletion(stepType, sRec.num)) { // The result is true if the Achievement was completed AnnounceAchievementCompletion(ach); } } } } else { Debug.LogWarning("AchievementManager:AchievementStep( " + stepType + ", " + num + " )" + "was passed a stepType that is not in STEP_REC_DICT."); } }