public void Broke() { // This check sucks if (this.behavior is HealthySoulBehavior || this.behavior == null) { this.behavior = new BrokenSoulBehavior(this); this.behavior.Initialize(); this.UpdateEvents(); this.IsBroken = true; // Notify manager this.manager.OnSoulBroke(); } }
public void Repair() { // This check sucks even more if (this.behavior == null) { this.behavior = new HealthySoulBehavior(this); this.behavior.Initialize(); this.UpdateEvents(); this.IsBroken = false; } else if (this.behavior is BrokenSoulBehavior) { Destroy(this.gameObject); // Notify manager this.manager.OnSoulRepaired(); } }