using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using UnityEngine; namespace BITKit { public class ShowTime : MonoBehaviour { [SerializeReference,SubclassSelector]private IReference timeFormat; [SerializeReference,SubclassSelector]private IProvider output; [SerializeField] private bool isTimerNotClock; private DateTime _dateTime; private DateTime _startTime; // Update is called once per frame protected void Start() { _startTime = DateTime.Now; } protected void Update() { var time = DateTime.Now; if (isTimerNotClock) { time =new DateTime( DateTime.Now.Ticks - _startTime.Ticks); } output?.Set(timeFormat is not null ? time.ToString(timeFormat.Value) : time.ToString(CultureInfo.InvariantCulture)); } } }