using UnityEngine;
using System.Collections;
public class DayNight : MonoBehaviour{}
// Use this for initialization
void start (){
private float, smooth = 0.0000000000005;
}
// Update is called once per frame
void Update () {
IEnumerator IntensityChanging ()
{
float intensityA = 0.05f;
float intensityB = 5f;;
while( 1 == 1){
newIntensity = intensityA;
newIntensity = intensityB;
light.intensity = Math.Lerp(light.intensity, newIntensity, smooth * Time.deltaTime);
}
}
}
错误
Assets / Scripts / DayNight.cs(7,15):错误CS1525:意外符号private'
Assets/Scripts/DayNight.cs(6,14): error CS0116: A namespace can only contain types and namespace declarations
Assets/Scripts/DayNight.cs(13,39): error CS1525: Unexpected symbol
(',期待)',
,',;',
[&#39 ;或者`='
Assets / Scripts / DayNight.cs(10,14):错误CS0116:命名空间只能包含类型和名称空间声明
Assets / Scripts / DayNight.cs(25,1):错误CS8025:解析错误
提前致谢。
答案 0 :(得分:2)
所有代码都无法使用,似乎很多copypaste没有任何意义。
我能想到的最接近的是:
using UnityEngine;
using System.Collections;
public class DayNight : MonoBehaviour{
private float smooth = 0.0000000000005;
// Use this for initialization
void start (){
}
float accumulate = 0;
// Update is called once per frame
void Update ()
{
float intensityA = 0.05f;
float intensityB = 5f;
accumulate += Time.deltaTime;
light.intensity = Math.Lerp(intensityA, intensityB, smooth * accumulate);
}
}
该代码唯一的问题是光线来自无处,你需要光的参考。