add time based street light, fix directional room entrance

This commit is contained in:
2026-03-17 23:12:13 -05:00
parent 87527b70f7
commit 069cfdd953
7 changed files with 51 additions and 12 deletions
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Linq;
using UnityEngine;
public class Streetlight : MonoBehaviour
{
// Hours that the light starts and ends
public int[] activeHours = { 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6 };
Light objectLight;
private float lightIntensity;
void Start()
{
objectLight = GetComponent<Light>();
lightIntensity = objectLight.intensity;
}
// Update is called once per frame
void Update()
{
if (activeHours.Contains(GameManager.Instance.TimeManager.GetCurrentHour()))
{
objectLight.intensity = lightIntensity;
}
else
{
objectLight.intensity = 0;
}
}
}