gutterball-3/Gutterball 3/Assets/Standard Assets/Water (Pro Only)/Water4/Sources/Scripts/SpecularLighting.cs
SkunkStudios 71779ef7ac New Version 1.6
New 125 balls & powerups.
Improved graphics.
2025-05-07 06:18:40 +07:00

24 lines
570 B
C#

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