trouble-in-terror-town/Assets/Scripts/Player/Character/UI/SpectatorUI.cs
Mikolaj 073d076628 Added roles with runtime json loading also did some more
Added roles with runtime json loading also added a conceptual round system
2022-05-05 21:58:03 +02:00

57 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using System;
public class SpectatorUI : MonoBehaviour
{
private RoundSystem _roundSystem;
[SerializeField]
private TMP_Text _timer;
// Start is called before the first frame update
void Start()
{
_roundSystem = FindObjectOfType<RoundSystem>();
}
// Update is called once per frame
void Update()
{
//UiClock();
}
private void UiClock()
{
var timeUntillStart = _roundSystem.currentTimer - ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
var unixMinutes = timeUntillStart / 60;
var unixSeconds = timeUntillStart % 60;
string minutes = null;
string seconds = null;
if (unixMinutes > 9)
{
minutes = unixMinutes.ToString();
}
else
{
minutes = "0" + unixMinutes.ToString();
}
if (unixSeconds > 9)
{
seconds = unixSeconds.ToString();
}
else
{
seconds = "0" + unixSeconds.ToString();
}
_timer.text = minutes.ToString() + ":" + seconds;
}
}