using UnityEngine;
using System.Collections;

public class Completion : MonoBehaviour 
{
	float speed = 5f;
	public Transform moveTo;
	Vector3 moveToPos;
	bool move;

	int levelsCompleted;
	int howManyLevels = 3;

	void Start()
	{
		moveToPos = moveTo.transform.position;
	}

	public void CompletedLevel()
	{
		levelsCompleted++;

		if (levelsCompleted == howManyLevels)
		{
			//move gate
			move = true;
		}
	}

	void Update()
	{
		if (move)
		{
			transform.position = Vector3.MoveTowards(transform.position, moveToPos, speed * Time.deltaTime);
			
			if (transform.position == moveTo.transform.position)
			{
				move = false;
			}
		}	
	}
}
