win/lose hold stats, hp crystal expiration

This commit is contained in:
msk
2022-01-26 01:23:39 -08:00
parent 6f938e95c8
commit fcea383739
22 changed files with 657 additions and 60 deletions
+33
View File
@@ -0,0 +1,33 @@
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);
}
}