alotta upgrade stuff but no upgrades
This commit is contained in:
parent
b9fb490dce
commit
3b60583c76
35 changed files with 2937 additions and 61 deletions
40
Assets/Scripts/Abilities/AbilityHotbarIcon.cs
Normal file
40
Assets/Scripts/Abilities/AbilityHotbarIcon.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class AbilityHotbarIcon : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject overlay;
|
||||
[SerializeField] private TextMeshProUGUI cooldownText;
|
||||
[SerializeField] private TextMeshProUGUI text;
|
||||
private bool onCooldown;
|
||||
private PlayerAbility thisAbility;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (onCooldown)
|
||||
{
|
||||
cooldownText.text = thisAbility.currentCooldown.ToString("F2");
|
||||
if (thisAbility.currentCooldown <= 0)
|
||||
{
|
||||
onCooldown = false;
|
||||
overlay.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCooldown()
|
||||
{
|
||||
if (thisAbility.currentCooldown > 0)
|
||||
{
|
||||
onCooldown = true;
|
||||
overlay.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAbility(PlayerAbility ability)
|
||||
{
|
||||
thisAbility = ability;
|
||||
text.text = thisAbility.abilityName;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue