summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/AchievementManager.cs
blob: 0cedf23ea0d80f8f0c9090cf84c1465c6ba1da2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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);
		}
	}
}