mirror of
https://github.com/DerTyp7/grow-ai-unity.git
synced 2025-11-01 22:02:28 +01:00
init
This commit is contained in:
25
Assets/Scripts/TimeUI.cs
Normal file
25
Assets/Scripts/TimeUI.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class TimeUI : MonoBehaviour
|
||||
{
|
||||
TextMeshProUGUI dateTimeText;
|
||||
TimeManager timeManager;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
timeManager = GameObject.Find("GameManager").GetComponent<TimeManager>();
|
||||
TimeManager.OnTimeInterval += OnInterval;
|
||||
dateTimeText = GetComponent<TextMeshProUGUI>();
|
||||
|
||||
}
|
||||
|
||||
void OnInterval()
|
||||
{
|
||||
DateTime dateTime = timeManager.GetDateTime();
|
||||
if (dateTimeText != null)
|
||||
dateTimeText.text = dateTime.ToString("hh:mm tt / dd.MM.yyyy", timeManager.cultureInfo);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user