30 lines
674 B
C#
30 lines
674 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using Unity.Mathematics;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Menu.Person
|
||
|
{
|
||
|
public class LightBlinker : MonoBehaviour
|
||
|
{
|
||
|
public float time = 0.1f;
|
||
|
|
||
|
private Light _light;
|
||
|
private int _a;
|
||
|
private float _initialIntensity;
|
||
|
IEnumerator Start()
|
||
|
{
|
||
|
_light = GetComponent<Light>();
|
||
|
_initialIntensity = _light.intensity;
|
||
|
|
||
|
while (true)
|
||
|
{
|
||
|
yield return new WaitForSeconds(time);
|
||
|
|
||
|
_a++;
|
||
|
_light.intensity = math.sin(_a) * _initialIntensity;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|