- 전구처럼 깜빡깜빡하는 효과
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class Test : MonoBehaviour
{
Light theLight;
private float targetIntensity;
private float currentIntensity;
private void Start()
{
theLight = GetComponent<Light>();
currentIntensity = theLight.intensity;
targetIntensity = Random.Range(0.1f, 10f);
}
void Update()
{
if (Mathf.Abs(targetIntensity - currentIntensity) >= 0.01)
{
if (targetIntensity - currentIntensity >= 0)
currentIntensity += Time.deltaTime * 3f;
else
currentIntensity -= Time.deltaTime * 3f;
theLight.intensity = currentIntensity;
theLight.range = 10 + currentIntensity;
}
else
{
targetIntensity = Random.Range(0.1f, 10f);
}
}
}
애니메이터 (0) | 2024.06.26 |
---|---|
애니메이션(animation) (0) | 2024.06.26 |
카메라(Camera) (0) | 2024.06.25 |
MeshRenderer, 마우스 클릭시 오브젝트 색 바꾸기 (0) | 2024.06.25 |
박스 콜라이더, 레이캐스트, OnTriggerEnter, OnCollisionEnter (0) | 2024.06.25 |