[Unity] Light(라이트)

박호준·2022년 2월 12일
0

Unity

목록 보기
7/17
  • Mode : 그림자 고정, 실시간 등

  • Intensity : 빛의 세기

  • Indirect Multiplier : 간접광의 세기

  • Shadow Type : 그림자

  • window - lighting

  • 반짝거리게 만들기


public class light : MonoBehaviour
{
    private Light theLight;
    private float targetIntensity;
    private float currenIntensity;
    void Start()
    {
        theLight = GetComponent<Light>();
        currenIntensity = theLight.intensity;
        targetIntensity = Random.Range(0.4f, 1f);
    }

    // Update is called once per frame
    void Update()
    {
        if(Mathf.Abs(targetIntensity - currenIntensity) >= 0.01)
        {
            if (targetIntensity - currenIntensity >= 0)
                currenIntensity += Time.deltaTime * 3f;
            else
                currenIntensity -= Time.deltaTime * 3f;
            theLight.intensity = currenIntensity;
            theLight.range = currenIntensity + 10;
        }
        else
        {
            targetIntensity = Random.Range(0.4f, 1f);
        }

    }
}
profile
hopark

0개의 댓글