mirror of
https://github.com/muskit/H3VR-TNH-Quality-of-Life-Improvements.git
synced 2026-06-03 04:34:26 -07:00
36 lines
685 B
C#
36 lines
685 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UIRingTimer : MonoBehaviour {
|
|
|
|
private bool initialized = false;
|
|
private float endTime;
|
|
private float length;
|
|
|
|
private Image ringImg;
|
|
|
|
private void Start()
|
|
{
|
|
ringImg = GetComponentInChildren<Image>();
|
|
}
|
|
|
|
public void Init(float timeInSeconds)
|
|
{
|
|
length = timeInSeconds;
|
|
endTime = Time.time + length;
|
|
initialized = true;
|
|
}
|
|
|
|
void Update () {
|
|
if (!initialized)
|
|
return;
|
|
|
|
float amount = (endTime - Time.time) / length;
|
|
ringImg.fillAmount = Mathf.Clamp01(amount);
|
|
|
|
transform.LookAt(MeatKitPlugin.playerCamera.transform);
|
|
}
|
|
}
|