public bool IsMatchCurrentTree(Merchant.ActionType _mode) { MerchantBehaviorTree merchantBehaviorTree = (MerchantBehaviorTree)null; this.behaviorTreeTable.TryGetValue(_mode, out merchantBehaviorTree); return(Object.op_Equality((Object)this.currentTree, (Object)merchantBehaviorTree)); }
public void ChangeMode(Merchant.ActionType _mode) { MerchantBehaviorTree merchantBehaviorTree = (MerchantBehaviorTree)null; if (!this.behaviorTreeTable.TryGetValue(_mode, out merchantBehaviorTree) || Object.op_Equality((Object)merchantBehaviorTree, (Object)null)) { return; } this.Mode = _mode; if (this.currentTree != null) { this.currentTree.DisableBehavior(false); } merchantBehaviorTree.DisableBehavior(false); this.currentTree = merchantBehaviorTree; ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)Observable.NextFrame((FrameCountType)0), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (System.Action <M0>)(_ => this.currentTree.EnableBehavior())); }
public void EnableBehavior() { MerchantBehaviorTree.CreateAIBehaviorManager(); if (Object.op_Inequality((Object)BehaviorManager.instance, (Object)null)) { ((BehaviorManager)BehaviorManager.instance).EnableBehavior((Behavior)this); } if (this._initialized) { return; } BehaviorSource behaviorSource = this.GetBehaviorSource(); for (int index = 0; index < 12; ++index) { this.get_HasEvent()[index] = this.TaskContainsMethod(((Behavior.EventTypes)index).ToString(), behaviorSource.get_RootTask()); } this._initialized = true; }
public void Initialize() { if (this.behaviorTreeTable == null) { this.behaviorTreeTable = new Dictionary <Merchant.ActionType, MerchantBehaviorTree>(); } foreach (Merchant.ActionType actionType in Enum.GetValues(typeof(Merchant.ActionType))) { MerchantBehaviorTree merchantBehavior = Singleton <Resources> .Instance.BehaviorTree.GetMerchantBehavior(actionType); if (!Object.op_Equality((Object)merchantBehavior, (Object)null)) { MerchantBehaviorTree merchantBehaviorTree = (MerchantBehaviorTree)Object.Instantiate <MerchantBehaviorTree>((M0)merchantBehavior); ((Component)merchantBehaviorTree).get_transform().SetParent(((Component)this).get_transform(), false); ((Component)merchantBehaviorTree).get_transform().SetPositionAndRotation(Vector3.get_zero(), Quaternion.get_identity()); this.behaviorTreeTable[actionType] = merchantBehaviorTree; merchantBehaviorTree.SourceMerchant = this.sourceMerchant; } } }
public MerchantBehaviorTree GetBehaviorTree(Merchant.ActionType _mode) { MerchantBehaviorTree merchantBehaviorTree = (MerchantBehaviorTree)null; return(this.behaviorTreeTable.TryGetValue(_mode, out merchantBehaviorTree) ? merchantBehaviorTree : (MerchantBehaviorTree)null); }