using UnityEngine;
using System.Collections;

public class PulseShieldUvAnimator : MonoBehaviour
{
    [SerializeField]
    float scrollSpeed = 0.5F;
    [SerializeField]
    int materialID = 0;

    Renderer rend;

    void Start()
    {
        rend = GetComponent<Renderer>();

    }
    void Update()
    {
        float offset = Time.time * scrollSpeed;


        if (rend.materials.Length <= materialID ||true)
        {
            Material[] tempList = rend.materials;
            Material temp = tempList[materialID];

            temp.SetTextureOffset("_MainTex", new Vector2(offset, 0));
            //temp.SetTextureOffset("_EmissionMap", new Vector2(offset, 0));

            tempList[materialID] = temp;

            rend.sharedMaterials = tempList;
        }
    }
}