private void ValidateEvent(GameStance unexpectedStance) { if (this.stance == unexpectedStance) { throw new InvalidOperationException("Event already triggered"); } }
public void TriggerRespawn() { ValidateEvent(GameStance.Playing); _onRespawn.Invoke(); stance = GameStance.Playing; }
public void TriggerDefeat() { ValidateEvent(GameStance.PausedAfterDefeat); _onDefeat.Invoke(); stance = GameStance.PausedAfterDefeat; }