28 lines
509 B
C#
28 lines
509 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
public class DyingLight : MonoBehaviour
|
|
{
|
|
Light2D l;
|
|
public float speed = 0.5f;
|
|
private void Awake()
|
|
{
|
|
l = GetComponent<Light2D>();
|
|
l.intensity = 0.5f;
|
|
}
|
|
void Update()
|
|
{
|
|
if(l.intensity < 0)
|
|
{
|
|
//Destroy(gameObject);
|
|
}
|
|
else
|
|
{
|
|
l.intensity -= Time.deltaTime * speed;
|
|
|
|
}
|
|
}
|
|
}
|