39 lines
799 B
C#
39 lines
799 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DSTManager : MonoBehaviour
|
|
{
|
|
public GameObject globeObject;
|
|
|
|
private float _timer;
|
|
private const float INTERVAL = 3600f;
|
|
|
|
void Start()
|
|
{
|
|
RefreshAll();
|
|
_timer = INTERVAL;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
_timer -= Time.deltaTime;
|
|
if (_timer <= 0f)
|
|
{
|
|
RefreshAll();
|
|
_timer = INTERVAL;
|
|
}
|
|
}
|
|
|
|
void RefreshAll()
|
|
{
|
|
if (globeObject == null) return;
|
|
foreach (Transform child in globeObject.transform)
|
|
{
|
|
if (child.gameObject.name == "Ocean") continue;
|
|
CountryData cd = child.GetComponent<CountryData>();
|
|
if (cd != null) cd.RefreshDST();
|
|
}
|
|
}
|
|
}
|