光照范围。
另请参阅:Light component。
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public float duration = 3.0F; public float originalRange; public Light lt; void Start() { lt = GetComponent<Light>(); originalRange = lt.range; } void Update() { float amplitude = Mathf.PingPong(Time.time, duration); amplitude = amplitude / duration * 0.5F + 0.5F; lt.range = originalRange * amplitude; } }