using UnityEngine;
using System.Collections;

public class wealk : MonoBehaviour {
	public Transform distancia;
	Botao inter;
	public GameObject cube;

	// Use this for initialization
	void Start() {
		inter = cube.GetComponent<Botao> ();

	}
	
	// Update is called once per frame
	void Update(){
						if (inter.caminho == false) {
								transform.Translate (0.1f, 0, 0);
								if (transform.position.x > -30f) {
										transform.eulerAngles = new Vector3 (0, 180, 0);


								}
								if (transform.position.x < -20f) {
										transform.eulerAngles = new Vector3 (0, 0, 0);

								}
						}
						if (inter.caminho == true) {
								transform.Translate (0, 0, 0.1f);
								if (transform.position.z > 40f) {
										transform.eulerAngles = new Vector3 (0, 180, 0);
								}
								if (transform.position.z < 20f) {
				transform.eulerAngles = new Vector3 (0, 0,0);}
		}}
			void OnTriggerEnter(Collider other){
	
	
	}}


	
	

