using UnityEngine;
using System.Collections;

public class Parallax : MonoBehaviour {


    private Material material;
	public float velocidade;
	private float offset;
    public bool ativarParallax;

	void Start () {
		material = renderer.material;
	}
    void Update () {
		if(ativarParallax==true){
            AtivarParallax();
        }
	}

    void AtivarParallax()
    {
        offset += 0.001f;
        material.SetTextureOffset("_MainTex", new Vector2(offset * velocidade, 0));
    }




}
