var range : float
Description
The range of the light.
See Also: Light component
var duration :
float = 3.0;
private var originalRange :
float;
originalRange = light.range;
function Update() {
var amplitude :
float =
Mathf.PingPong(
Time.time, duration );
amplitude = amplitude / duration * 0.5 + 0.5;
light.range = originalRange * amplitude;
}
using UnityEngine;
using System.Collections;
public class example :
MonoBehaviour {
public float duration = 3.0F;
private float originalRange;
void Update() {
float amplitude =
Mathf.PingPong(
Time.time, duration);
amplitude = amplitude / duration * 0.5F + 0.5F;
light.range = originalRange * amplitude;
}
void Awake() {
originalRange = light.range;
}
}
import UnityEngine
import System.Collections
class example(
MonoBehaviour):
public duration as single = 3.0F
private originalRange as single
def
Update():
amplitude as single =
Mathf.PingPong(
Time.time, duration)
amplitude = (((amplitude / duration) * 0.5F) + 0.5F)
light.range = (originalRange * amplitude)
def
Awake():
originalRange = light.range