36 lines
756 B
C#
36 lines
756 B
C#
using UnityEngine;
|
|
|
|
namespace Artngame.SKYMASTER
|
|
{
|
|
public class RiverHandlerSM : MonoBehaviour
|
|
{
|
|
private Material mat;
|
|
|
|
public float scrollSpeed = 0.1f;
|
|
|
|
public Transform lightDir;
|
|
|
|
private void Start()
|
|
{
|
|
mat = GetComponent<Renderer>().material;
|
|
mat.shader.maximumLOD = 600;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float num = Time.time * scrollSpeed;
|
|
mat.SetTextureOffset("_MainTex", new Vector2(num * 0.5f, num * 1f));
|
|
mat.SetTextureOffset("_HeightTex", new Vector2(num / 2f, num));
|
|
mat.SetTextureOffset("_FoamTex", new Vector2(num / 4f, num * 1f));
|
|
if ((bool)lightDir)
|
|
{
|
|
mat.SetVector("_WorldLightDir", lightDir.forward);
|
|
}
|
|
else
|
|
{
|
|
mat.SetVector("_WorldLightDir", new Vector3(0.7f, 0.7f, 0f));
|
|
}
|
|
}
|
|
}
|
|
}
|