MayHeCome/Assets/Scripts/DayNightLightChanger.cs

28 lines
692 B
C#
Raw Normal View History

2024-12-18 09:55:34 +00:00
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));
}
}