using UnityEngine;
using System.Collections;

public class Ship_AI : MonoBehaviour 
{
	public Transform[] gridPoints;
	private int currentPoint;
	
	public float speed = 5.0f;


	void Start()
	{
		currentPoint = 0;
	}

	void Update()
	{
		if (transform.position == gridPoints[currentPoint].position)
		{
			currentPoint++;
		}
		
		if (currentPoint >= gridPoints.Length)
		{
			currentPoint = 0;
		}

		transform.position = Vector3.MoveTowards(transform.position, gridPoints[currentPoint].position, speed * Time.deltaTime);
	}
}
