MayHeCome/Assets/Scripts/DayNightLightChanger.cs
2024-12-18 17:55:34 +08:00

28 lines
692 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DayNightLightChanger : MonoBehaviour
{
public List<GameObject> DayActiveObjects = new();
public List<GameObject> NightActiveObjects = new();
void Start()
{
GameProcedureManager.Instance.OnNight += OnNight;
GameProcedureManager.Instance.OnDay += OnDay;
}
public void OnNight()
{
DayActiveObjects.ForEach(o=>o.SetActive(false));
NightActiveObjects.ForEach(o=>o.SetActive(true));
}
public void OnDay()
{
DayActiveObjects.ForEach(o=>o.SetActive(true));
NightActiveObjects.ForEach(o=>o.SetActive(false));
}
}