using UnityEngine;

public class UVScrolling : MonoBehaviour
{
    [SerializeField]
    private Vector2 m_uvAnimationRate = new Vector2(0.0f, -1.0f);
    [SerializeField]
    private Vector2 m_uvOffset = new Vector2(0.0f, 0.0f);
    [SerializeField]
    private Renderer m_renderer = null;

    private Vector2 m_uvCurrentOffset = Vector2.zero;

    #region Unity Callback
    // Use this for initialization
    protected void Start () 
	{
        	
	}
	
	// Update is called once per frame
	protected void Update ()
	{
        m_uvCurrentOffset += GameManager.ScrollingSpeed * m_uvAnimationRate * Time.deltaTime;
        m_renderer.materials[0].SetTextureOffset("_MainTex", m_uvCurrentOffset + m_uvOffset);
    }
#endregion
}
