using UnityEngine;
using System.Collections;

public class MoveLight : MonoBehaviour
{
		public float speed = 0.1f;
	
		Vector3 newPos;
	
		float width;
	
		float dir = -1f;
	
		void Start ()
		{
				width = Camera.main.ViewportToWorldPoint (Vector3.one).x;
		}
	
		void Update ()
		{
				newPos = transform.position;
		
				newPos.x += dir * speed * Time.deltaTime * 100;
		
				if (newPos.x < -width || newPos.x > width) {
						dir = -dir;
				}
		
				transform.position = newPos;
		}
}
