Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Transform[] patrolpoints;
- int currentPatrolPoint;
- void update() {
- if(transform.position == patrolpoints[currentPatrolPoint].position) {
- currentPatrolPoint++;
- }
- if(currentPatrolPoint > patrolpoints.Length) {
- currentPatrolPoint = 0;
- }
- // the the moving part here accessing the current
- transform.position = Vector2.moveTowards(transform.position, patrolpoints[currentPatrolPoint], speed * Time.deltaTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement