Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void FixedUpdate()
- {
- switch (state)
- {
- case State.Patrolling:
- Patrol();
- break;
- }
- }
- private void Patrol()
- {
- if (state != State.Patrolling)
- return;
- aiDestinationSetter.target = waypoints[waypointIndex];
- if (Vector2.Distance(transform.position, waypoints[waypointIndex].transform.position) <= 0.17f)
- waypointIndex++;
- if (waypointIndex == waypoints.Count)
- waypointIndex = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement