Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AchievementCondition.cs
Go to the documentation of this file.
1using Newtonsoft.Json;
2using Newtonsoft.Json.Linq;
3
5
6[JsonObject(/*Could not decode attribute arguments.*/)]
7public abstract class AchievementCondition
8{
9 public delegate void AchievementUpdate(AchievementCondition condition);
10
11 public readonly string Name;
12
14
15 [JsonProperty("Completed")]
16 private bool _isCompleted;
17
18 public bool IsCompleted => _isCompleted;
19
21
22 protected AchievementCondition(string name)
23 {
24 Name = name;
25 }
26
27 public virtual void Load(JObject state)
28 {
29 _isCompleted = (bool)state["Completed"];
30 }
31
32 public virtual void Clear()
33 {
34 _isCompleted = false;
35 }
36
37 public virtual void Complete()
38 {
39 if (!_isCompleted)
40 {
41 _isCompleted = true;
42 if (this.OnComplete != null)
43 {
44 this.OnComplete(this);
45 }
46 }
47 }
48
50 {
51 return null;
52 }
53
55 {
56 if (_tracker == null)
57 {
59 }
60 return _tracker;
61 }
62}
virtual IAchievementTracker CreateAchievementTracker()
delegate void AchievementUpdate(AchievementCondition condition)