Files
2026-03-04 10:03:45 +08:00

31 lines
657 B
C#

using UnityEngine;
namespace UnityStandardAssets.Water
{
[RequireComponent(typeof(WaterBase))]
[ExecuteInEditMode]
public class SpecularLighting : MonoBehaviour
{
public Transform specularLight;
private WaterBase m_WaterBase;
public void Start()
{
m_WaterBase = (WaterBase)base.gameObject.GetComponent(typeof(WaterBase));
}
public void Update()
{
if (!m_WaterBase)
{
m_WaterBase = (WaterBase)base.gameObject.GetComponent(typeof(WaterBase));
}
if ((bool)specularLight && (bool)m_WaterBase.sharedMaterial)
{
m_WaterBase.sharedMaterial.SetVector("_WorldLightDir", specularLight.transform.forward);
}
}
}
}