mixedcards/Assets/Battle/InsightLevel.cs
2020-09-22 01:09:20 -04:00

23 lines
No EOL
559 B
C#

public class InsightLevel {
public delegate void InsightLevelChangedAction();
public event InsightLevelChangedAction OnChanged;
private int level;
public InsightLevel(int initialLevel) {
this.level = initialLevel;
}
public void Modify(int amount) {
int previousLevel = this.level;
this.level += amount;
if (this.level < 0) this.level = 0;
if (this.level != previousLevel && this.OnChanged != null) {
this.OnChanged();
}
}
public int Level {get => this.level;}
}