using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Escalator : MonoBehaviour 
{

	public Transform[] waypoints;

	public Transform GetNextWaypoint (Vector3 pos)
	{
		for (int i = 0; i < waypoints.Length; i++)
		{
			if (pos == waypoints [i].position)
			{
				if (i == waypoints.Length - 1)
				{
					// Return first
					return waypoints [0];
				} 
				else
				{
					return waypoints [i+=1];
				}
			}
		}
		// Could not find next waypoint
		return null;
	}

}
