21 lines
458 B
C#
21 lines
458 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class RealTimeLight : MonoBehaviour
|
|
{
|
|
private Light _light;
|
|
[SerializeField] private float enabledDistance;
|
|
private void Awake()
|
|
{
|
|
_light = GetComponent<Light>();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
float dist = Vector3.Distance(transform.position, Player.Instance.transform.position);
|
|
|
|
_light.enabled = dist < enabledDistance;
|
|
}
|
|
}
|