Implement Triggers and Scarring
This commit is contained in:
parent
cbc8c8b6cd
commit
265c24ea1c
18 changed files with 247 additions and 5 deletions
36
Assets/Battle/Trigger.cs
Normal file
36
Assets/Battle/Trigger.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
public enum TriggerExpiration {
|
||||
Never,
|
||||
StartOfNextHeroTurn,
|
||||
}
|
||||
|
||||
public enum TriggerRepetition {
|
||||
Once,
|
||||
Multiple,
|
||||
}
|
||||
|
||||
public class Trigger {
|
||||
|
||||
private TriggeredEffect callback;
|
||||
private TriggerExpiration expiration;
|
||||
private TriggerRepetition repetition;
|
||||
private bool expired;
|
||||
|
||||
public Trigger(TriggeredEffect callback, TriggerExpiration expiration,
|
||||
TriggerRepetition repetition) {
|
||||
this.callback = callback;
|
||||
this.expiration = expiration;
|
||||
this.repetition = repetition;
|
||||
}
|
||||
|
||||
public void Run(IBattleEffectApplier effectApplier) {
|
||||
if (this.expired) return;
|
||||
callback(effectApplier);
|
||||
if (this.repetition == TriggerRepetition.Once) {
|
||||
this.expired = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Expired {get => this.expired;}
|
||||
public TriggerExpiration Expiration {get => this.expiration;}
|
||||
public TriggerRepetition Repetition {get => this.repetition;}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue