private void Awake() { movementController = GetComponent <ICanMove>(); mover = GetComponent <AStarMover>(); interactionMechanics = GetComponent <InteractionMechanics>(); followMechanics = GetComponent <FollowMechanics>(); followMechanics.OnFollowTransformDestroyed += OnFollowTransformDestroyed; var startingState = new IdleState(); var moveState = new WalkState(); var sprintState = new RunningState(); var followState = new FollowState(); var dashingState = new DashingState(); InitializeStateMachine(new List <IState> { startingState, moveState, sprintState, followState, dashingState }, startingState); }
public override void SetState(StateMachine sm) { base.SetState(sm); followMechanics = stateMachine.GetComponent <FollowMechanics>(); }