diff options
Diffstat (limited to 'Thronefall_v1.0/Decompile/AchievementManager.cs')
-rw-r--r-- | Thronefall_v1.0/Decompile/AchievementManager.cs | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Thronefall_v1.0/Decompile/AchievementManager.cs b/Thronefall_v1.0/Decompile/AchievementManager.cs new file mode 100644 index 0000000..0cedf23 --- /dev/null +++ b/Thronefall_v1.0/Decompile/AchievementManager.cs @@ -0,0 +1,78 @@ +using System; +using Steamworks; +using UnityEngine; + +public class AchievementManager : MonoBehaviour +{ + public enum Achievements + { + START_TUTORIAL, + COMPLETE_TUTORIAL, + NORDFELS_BEATEN, + NORDFELS_QUESTSCOMPLETE, + DURSTSTEIN_BEATEN, + DURSTSTEIN_QUESTSCOMPLETE, + FROSTSEE_BEATEN, + FROSTSEE_QUESTSCOMPLETE, + MAXLEVEL_REACHED + } + + public static void UnlockAchievement(Achievements _achievement) + { + if (SteamManager.Initialized) + { + SteamUserStats.SetAchievement(_achievement.ToString()); + } + } + + public static void ResetAllAchievements() + { + if (!Application.isPlaying) + { + Debug.LogWarning("Warning: Resetting achievements only works while in play mode."); + return; + } + string[] names = Enum.GetNames(typeof(Achievements)); + for (int i = 0; i < names.Length; i++) + { + SteamUserStats.ClearAchievement(names[i]); + } + } + + public static void LevelBeaten(string _scene) + { + if (_scene == "Neuland(Tutorial)") + { + UnlockAchievement(Achievements.START_TUTORIAL); + UnlockAchievement(Achievements.COMPLETE_TUTORIAL); + } + if (_scene == "Nordfels") + { + UnlockAchievement(Achievements.NORDFELS_BEATEN); + } + if (_scene == "Durststein") + { + UnlockAchievement(Achievements.DURSTSTEIN_BEATEN); + } + if (_scene == "Frostsee") + { + UnlockAchievement(Achievements.FROSTSEE_BEATEN); + } + } + + public static void LevelAllQuestsComplete(string _scene) + { + if (_scene == "Nordfels") + { + UnlockAchievement(Achievements.NORDFELS_QUESTSCOMPLETE); + } + if (_scene == "Durststein") + { + UnlockAchievement(Achievements.DURSTSTEIN_QUESTSCOMPLETE); + } + if (_scene == "Frostsee") + { + UnlockAchievement(Achievements.FROSTSEE_QUESTSCOMPLETE); + } + } +} |