Light.intensity 强度

var intensity : float

Description描述

The Intensity of a light is multiplied with the Light color.

一个灯光被乘以灯光颜色的强度。

The value can be between 0 and 8. This allows you to create over bright lights.

这个值在0到8之间,这允许你创建更亮的灯光。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public float duration = 1.0F;
	void Update() {
		float phi = Time.time / duration * 2 * Mathf.PI;
		float amplitude = Mathf.Cos(phi) * 0.5F + 0.5F;
		light.intensity = amplitude;
	}
}
// Pulse light's intensity over time
//随时间改变光照强度
var duration : float= 1.0;
function Update() {
	// argument for cosine
	//余弦理论
	var phi : float = Time.time / duration * 2 * Mathf.PI;
	// get cosine and transform from -1..1 to 0..1 range
	//获取余弦,并将范围从-1~1变为0~1
	var amplitude : float = Mathf.Cos( phi ) * 0.5 + 0.5;
	// set light color
	//设置灯光颜色
	light.intensity = amplitude;
}
Page last updated: 2011-3-30