Initial commit
This commit is contained in:
38
Assets/Scripts/Countries/DSTManager.cs
Normal file
38
Assets/Scripts/Countries/DSTManager.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user