示例#1
0
        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);
        }
示例#2
0
 void Awake()
 {
     CanMove = GetComponent <ICanMove>();
     rb      = GetComponent <Rigidbody2D>();
 }
示例#3
0
 public Move(ICanMove target) => this.target = target;