AchievementManager
A class in Root.Township, Alta.Achievements.
Singleton that loads every achievement and stat definition from Resources and passes unlocks and stat changes to Steam. Client side; get it through Instance.
- Listed in Players and characters
- Inherits or implements
SingletonBehaviour<AchievementManager>,IAchievementManager,IStatManager - Derived types
AchievementManager
Constructors
| Member | What it is |
|---|---|
AchievementManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private Dictionary<AchievementDefinition, Achievement> achievementMap | Achievement objects keyed by their definition asset. |
private List<Achievement> achievements | List of every loaded achievement. |
private AchievementDefinition[] definitions | Achievement definition assets loaded from Resources. |
private PlatformStats platformStats | The platform backend; always a SteamStats in this build. |
private AchievementStatDefinition[] statDefinitions | Stat definition assets loaded from Resources. |
private Dictionary<AchievementStatDefinition, Stat> statMap | Stat objects keyed by their definition asset. |
private List<Stat> stats | List of every loaded stat. |
Methods
| Member | What it is |
|---|---|
Achievement GetAchievement(string identifier) | Finds an achievement by identifier (the definition asset's name) or by definition. The string overload throws if none matches. |
Achievement GetAchievement(AchievementDefinition definition) | Finds an achievement by identifier (the definition asset's name) or by definition. The string overload throws if none matches. |
Stat GetStat(string identifier) | Finds a stat by identifier (the definition asset's name) or by definition. The string overload throws if none matches. |
Stat GetStat(AchievementStatDefinition definition) | Finds a stat by identifier (the definition asset's name) or by definition. The string overload throws if none matches. |
void UpdateAll() | Asks the platform to refresh every achievement and stat. Called once Steam reports stats received. |
protected override void Awake() | Loads definitions from the Achievements and Stats Resources folders, builds the maps, starts SteamStats and runs SetupAchievements.Setup. |
5 private and internal methods
| Member | What it is |
|---|---|
private void Alta.Achievements.IStatManager.Changed(Stat stat) | Explicit IStatManager method: called when a stat's value is set, and forwards it to the platform stats. |
private void Alta.Achievements.IAchievementManager.Complete(Achievement achievement) | Explicit IAchievementManager method: unlocks the achievement on the platform (Steam). |
private void LateUpdate() | Runs the platform stats' per-frame work (requesting and storing Steam stats). |
private void Alta.Achievements.IAchievementManager.RequestUpdate(Achievement achievement) | Explicit interface methods: ask the platform for the current state of one achievement or stat. |
private void Alta.Achievements.IStatManager.RequestUpdate(Stat stat) | Explicit interface methods: ask the platform for the current state of one achievement or stat. |