public void ChangeMode(Desire.ActionType mode) { AgentBehaviorTree agentBehaviorTree; if (!this._behaviorTreeTable.TryGetValue(mode, out agentBehaviorTree) || Object.op_Equality((Object)this.Current, (Object)agentBehaviorTree)) { return; } Debug.Log((object)string.Format("[{0}] モード変更 {1} → {2}", (object)((Object)((Component)this.SourceAgent).get_gameObject()).get_name(), (object)this.Mode, (object)mode)); this.Mode = mode; this.Current?.DisableBehavior(false); this._current = agentBehaviorTree; ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.NextFrame((FrameCountType)0), (System.Action <M0>)(_ => this.Current.EnableBehavior())); }
public void EnableBehavior() { AgentBehaviorTree.CreateAIBehaviorManager(); if (Object.op_Inequality((Object)BehaviorManager.instance, (Object)null)) { ((BehaviorManager)BehaviorManager.instance).EnableBehavior((Behavior)this); } BehaviorSource behaviorSource = this.GetBehaviorSource(); if (this._initialized) { return; } for (int index = 0; index < 12; ++index) { this.get_HasEvent()[index] = this.TaskContainsMethod(((Behavior.EventTypes)index).ToString(), behaviorSource.get_RootTask()); } }
public void Initialize(AgentActor actor) { this.SourceAgent = actor; this._behaviorTreeTable.Clear(); foreach (Tutorial.ActionType actionType in Enum.GetValues(typeof(Tutorial.ActionType))) { AgentBehaviorTree tutorialBehavior = Singleton <Resources> .Instance.BehaviorTree.GetTutorialBehavior(actionType); if (!Object.op_Equality((Object)tutorialBehavior, (Object)null)) { AgentBehaviorTree agentBehaviorTree = (AgentBehaviorTree)Object.Instantiate <AgentBehaviorTree>((M0)tutorialBehavior); ((Component)agentBehaviorTree).get_transform().SetParent(((Component)this).get_transform(), false); ((Component)agentBehaviorTree).get_transform().SetPositionAndRotation(Vector3.get_zero(), Quaternion.get_identity()); this._behaviorTreeTable[actionType] = agentBehaviorTree; agentBehaviorTree.SourceAgent = actor; agentBehaviorTree.set_StartWhenEnabled(false); } } }
public void ChangeMode(Tutorial.ActionType mode) { AgentBehaviorTree agentBehaviorTree; if (!this._behaviorTreeTable.TryGetValue(mode, out agentBehaviorTree) || Object.op_Equality((Object)agentBehaviorTree, (Object)null) || Object.op_Equality((Object)this._current, (Object)agentBehaviorTree)) { return; } this.Mode = mode; if (this._current != null) { this._current.DisableBehavior(false); } this._current = agentBehaviorTree; if (this._nextDisposable != null) { this._nextDisposable.Dispose(); } this._nextDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.NextFrame((FrameCountType)0), (System.Action <M0>)(_ => this.Current.EnableBehavior())); }