private void Start() { this.owner = this.GetComponentInParent <Actor>(); this.currentElement = this.bundles[this.currentBundleId].Element.Clone; this.currentElement.Enter(this.owner, this.disposables); this.UpdateAsObservable() .SubscribeWithState(this, (_, _this) => _this.ChangeAI()); }
private void ChangeAI() { if (!this.currentElement.CanExit) { return; } var bundle = this.bundles[this.currentBundleId]; foreach (var c in bundle.ConditionBundles) { if (c.Condition.Evalute(this.owner)) { bundle.Element.Exit(); this.disposables.Clear(); this.currentBundleId = c.NextBundleId; this.currentElement = this.bundles[this.currentBundleId].Element.Clone; this.currentElement.Enter(this.owner, this.disposables); break; } } }