public override void FSMSetup() { this.myTarget = null; UnitState_IDLE state_IDLE = new UnitState_IDLE(this); state_IDLE.AddTransition(Transition.IdleToSearch, StateID.SEARCH); UnitState_TargetFind state_TargetFind = new UnitState_TargetFind(this); state_TargetFind.AddTransition(Transition.SearchToWalk, StateID.WALK); state_TargetFind.AddTransition(Transition.SearchToIdle, StateID.IDLE); UnitState_Walk state_Walk = new UnitState_Walk(this); state_Walk.AddTransition(Transition.WalkToAttack, StateID.ATTACK); state_Walk.AddTransition(Transition.WalkToSearch, StateID.SEARCH); state_Walk.AddTransition(Transition.WalkToIdle, StateID.IDLE); UnitState_Attack state_Attack = new UnitState_Attack(this); state_Attack.AddTransition(Transition.AttackToSearch, StateID.SEARCH); state_Attack.AddTransition(Transition.AttackToIdle, StateID.IDLE); this.Fsm = new FSMSystem(); this.Fsm.CreateStates(); this.Fsm.AddState(state_IDLE); this.Fsm.AddState(state_TargetFind); this.Fsm.AddState(state_Walk); this.Fsm.AddState(state_Attack); }
public override void FSM_SetUp() { this.myTarget = null; UnitState_IDLE idleState = new UnitState_IDLE(this); idleState.AddTransition(Transition.IdleToSearch, StateID.SEARCH); UnitState_TargetFind targetFindState = new UnitState_TargetFind(this); targetFindState.AddTransition(Transition.SearchToWalk, StateID.WALK); targetFindState.AddTransition(Transition.SearchToIdle, StateID.IDLE); UnitState_Walk walkState = new UnitState_Walk(this); walkState.AddTransition(Transition.WalkToAttack, StateID.ATTACK); walkState.AddTransition(Transition.WalkToSearch, StateID.SEARCH); walkState.AddTransition(Transition.WalkToIdle, StateID.IDLE); UnitState_Attack attackState = new UnitState_Attack(this); attackState.AddTransition(Transition.AttackToSearch, StateID.SEARCH); attackState.AddTransition(Transition.AttackToIdle, StateID.IDLE); this.fsm = new FSMSystem(); this.fsm.CreateStates(); this.fsm.AddState(idleState); this.fsm.AddState(targetFindState); this.fsm.AddState(walkState); this.fsm.AddState(attackState); }
public override void OnTargetFind() { if (CurrentStateID != StateID.SEARCH) { return; } if (Fsm.CurrentState is UnitState_TargetFind) { UnitState_TargetFind state = (UnitState_TargetFind)Fsm.CurrentState; state.isSearchCompleted = true; } this.aILerp.canMove = true; }