diff --git a/Assets/UI overlay/AttackCooldown.cs b/Assets/UI overlay/AttackCooldown.cs index 878b98e..1f256bc 100644 --- a/Assets/UI overlay/AttackCooldown.cs +++ b/Assets/UI overlay/AttackCooldown.cs @@ -3,15 +3,17 @@ using UnityEngine; public class AttackCooldown : MonoBehaviour { Teo player; - TMPro.TMP_Sprite bar; + UnityEngine.UI.Image bar; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent(); + bar = GetComponent(); } // Update is called once per frame void Update() { + GetComponent().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Mathf.Min(100*(Time.fixedTime-player.lastAttackTime)/player.attackCooldownSeconds, 100)); } }