public override void StartTree(BTFiniteStateMachine sm) { base.StartTree(sm); Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>()); Blackboard.Add("Transform", transform); Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>()); Blackboard.Add("Transform", transform); Blackboard.Add("NecroInput", FindObjectOfType <NecromancerInput>()); target = MinionManager.manager.GetTarget(); mRoot = new BTRepeator (this, new BTStepSequencer (this, new BTNode[] { new BTParallel (this, new BTNode[] { new BTMoveToTarget(this, target), new BTAnimateMovement(this) } ), new BTParallel (this, new BTNode[] { new BTLookAtAim(this), new BTAnimateMovement(this) } ) } ) ); }
public override void StartTree(BTFiniteStateMachine sm) { base.StartTree(sm); Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>()); Blackboard.Add("Transform", transform); Blackboard.Add("WaitTime", 5f); Blackboard.Add("SearhLayer", GetComponent <Searcher>()); mRoot = new BTRepeator (this, new BTParallel (this, new BTNode[] { new BTStepSequencer (this, new BTNode[] { new BTParallel (this, new BTNode[] { new BTMoveToRandomRoomPoint(this), new BTAnimateMovement(this) } ), new BTIdleForTime(this) } ), new BTLookForTargets(this) }) ); }
public override void StartTree(BTFiniteStateMachine sm) { base.StartTree(sm); Transform followPoint = MinionManager.manager.GetPlayerSubMoveGuide(transform.GetComponent <MinionController>().minionIndex); Blackboard.Add("FollowTransform", followPoint != null ? followPoint : MinionManager.manager.GetPlayerCoreMoveGuide()); Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>()); Blackboard.Add("Transform", transform); Blackboard.Add("NecroInput", FindObjectOfType <NecromancerInput>()); mRoot = new BTRepeator (this, new BTStepSequencer (this, new BTNode[] { new BTParallel (this, new BTNode[] { new BTMoveToPlayer(this), new BTAnimateMovement(this) } ), new BTParallel (this, new BTNode[] { new BTLookAtAim(this), new BTAnimateMovement(this) } ) } ) ); }
public virtual void StartTree(BTFiniteStateMachine sm) { stateMachine = sm; Blackboard = new Dictionary <string, object>(); //initial behavior is stopped startedBehavior = false; //Example // ///*mRoot = new BTRepeator(this, new BTSequencer(this, new BTNode[] { new BTRandomWalk(this) }));*/ // }
private void InitFSM() { _btFiniteStateMachineManagerComponent = GetComponent <BTFiniteStateMachineManager>(); FSM = new BTFiniteStateMachine <FStatesBattle>(FStatesBattle.MENU); FSM.OnStarted_AddListener(FStatesBattle.MENU, Menu_Enter); FSM.OnStarted_AddListener(FStatesBattle.START, Start_Enter); FSM.OnStarted_AddListener(FStatesBattle.PLAYERTURN, PlayerTurn_Enter); FSM.OnStarted_AddListener(FStatesBattle.ENEMYTURN, EnemyTurn_Enter); FSM.OnStarted_AddListener(FStatesBattle.PLAYERWIN, PlayerWin_Enter); FSM.OnStarted_AddListener(FStatesBattle.ENEMYWIN, EnemyWin_Enter); FSM.OnStateChanged_AddListener(FSMOnStateChanged_Listener); _btFiniteStateMachineManagerComponent.AddFSM(FSM); }
/// <summary> /// Add events to FSM states and set initial state /// </summary> private void InitStates() { FSMFlyable = new BTFiniteStateMachine <FStatesFlyable>(StartInAir ? FStatesFlyable.Flying : FStatesFlyable.NotFlying); FSMFlyable.OnStarted_AddListener(FStatesFlyable.TakingOff, TakingOff_Enter); FSMFlyable.SetUpdateAction(FStatesFlyable.TakingOff, TakingOff_Update); FSMFlyable.OnStopped_AddListener(FStatesFlyable.TakingOff, TakingOff_Exit); FSMFlyable.OnStarted_AddListener(FStatesFlyable.Landing, Landing_Enter); FSMFlyable.SetUpdateAction(FStatesFlyable.Landing, Landing_Update); FSMFlyable.OnStarted_AddListener(FStatesFlyable.NotFlying, NotFlying_Enter); FSMFlyable.OnStopped_AddListener(FStatesFlyable.NotFlying, NotFlying_Exit); FSMFlyable.OnStarted_AddListener(FStatesFlyable.Flying, Flying_Enter); FSMFlyable.OnStateChanged_AddListener(OnFlyableStateChanged_Listener); CharacterAnimParams.TrySetFStateFlyable(AnimatorComponent, (int)FSMFlyable.CurrentState); }
// Start is called before the first frame update protected virtual void Start() { aiSystem = new BTFiniteStateMachine(this); aiSystem.ChangeTree <MinionFollowPlayer_BT>(); }
protected override void Start() { aiSystem = new BTFiniteStateMachine(this); aiSystem.ChangeTree <EnemyPatrol_BT>(); }