Implement Meditate
This commit is contained in:
parent
03ca23d484
commit
ceb46f98b2
14 changed files with 207 additions and 28 deletions
23
Assets/Battle/InsightLevel.cs
Normal file
23
Assets/Battle/InsightLevel.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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;}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue