源战役客户端
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 

31 рядки
605 B

using UnityEngine;
using System.Collections;
public class SceneLight : MonoBehaviour {
void Awake()
{
UpdateLight();
}
// void Update()
// {
//UpdateLight();
// }
void UpdateLight()
{
Light lit = GetComponent<Light>();
if (lit != null && lit.type == LightType.Directional)
{
Vector4 col = new Vector4(lit.color.r, lit.color.g, lit.color.b, lit.color.a);
col *= lit.intensity;
Shader.SetGlobalVector("_GlobalLightColor", col);
Vector3 dir = -lit.transform.forward;
Shader.SetGlobalVector("_GlobalLightDir", new Vector4(dir.x, dir.y, dir.z, 0f));
}
}
}