Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void MoveToNextIndex()
- {
- if (currentRouteIndex != -1 && this.transform.position != currentRoute.routePoints[currentRouteIndex].position)
- {
- moveTowardsVector = currentRoute.routePoints[currentRouteIndex].position - this.transform.position;
- normalizedVector = moveTowardsVector.normalized;
- //Move to next position
- if (Vector2.Distance(currentRoute.routePoints[currentRouteIndex].position, this.transform.position) > .1f)
- {
- myStateMachine.myState = AI_StateMachine.States.walking;
- myController.Walk(normalizedVector.x, normalizedVector.y);
- print(moveTowardsVector);
- }
- else if(Vector2.Distance(currentRoute.routePoints[currentRouteIndex].position, this.transform.position) <= .1f)
- {
- myStateMachine.myState = AI_StateMachine.States.idle;
- myController.Walk(0, 0);
- SetNextWaypoint();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement