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;
        }
    }
}
