mirror of
				https://github.com/DerTyp7/example-top-down-unity.git
				synced 2025-10-31 13:27:06 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			609 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			609 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| using TMPro;
 | |
| 
 | |
| public class TimeUI : MonoBehaviour
 | |
| {
 | |
|     [SerializeField]
 | |
|     TextMeshProUGUI dateTimeText;
 | |
|     TimeManager timeManager;
 | |
| 
 | |
|     private void Start()
 | |
|     {
 | |
|         timeManager = GameObject.Find("GameManager").GetComponent<TimeManager>();
 | |
|         TimeManager.OnTimeInterval += OnInterval;
 | |
|         
 | |
|     }
 | |
| 
 | |
|     void OnInterval()
 | |
|     {
 | |
|         DateTime dateTime = timeManager.GetDateTime();
 | |
|         if (dateTimeText != null)
 | |
|             dateTimeText.text = dateTime.ToString("hh:mm tt / dd.MM.yyyy", timeManager.cultureInfo);
 | |
|     }
 | |
| }
 | 
