using UnityEngine; using System.Collections; /*************** * FFWaterFlow class. * This class moves UV texture on material. **************/ public class FFWaterFlow : MonoBehaviour { public float m_SpeedU = 0.1f; public float m_SpeedV = -0.1f; // ###################################################################### // MonoBehaviour Functions // ###################################################################### // Update is called once per frame void Update () { float newOffsetU = Time.time * m_SpeedU; float newOffsetV = Time.time * m_SpeedV; if (this.GetComponent<Renderer>()) { GetComponent<Renderer>().material.mainTextureOffset = new Vector2(newOffsetU, newOffsetV); } } } |
|