using UnityEngine;
using System.Collections;

public class PreTime : MonoBehaviour {

	public GameObject timeManager;
	private TimeManager tim;
	public bool startTime = false;
	private Transform point;

	// Use this for initialization
	void Start () {
		tim = timeManager.GetComponent<TimeManager>();
		point = transform.Find("Point");
	}
	
	// Update is called once per frame
	void Update () {

		if (point.transform.position.x < -105) point.transform.position = new Vector3(-105, point.transform.position.y, point.transform.position.z);

		if (point.transform.position.x > -95) tim.NextStage();

		if(Input.GetAxis("Horizontal") > 0) {
			if(!startTime) startTime = true;

			point.transform.Translate(Vector3.right * Time.deltaTime);
		}
		else if(Input.GetAxis("Horizontal") < 0) {
			point.transform.Translate(Vector3.left * Time.deltaTime);
		}
	}
}
