36 lines
952 B
C#
36 lines
952 B
C#
using Cielonos.MainGame.Inventory;
|
|
using SLSFramework.UI;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Cielonos.UI
|
|
{
|
|
public class MainWeaponFunctionIcon : UIElementBase
|
|
{
|
|
public RuntimeFunctionUnit functionUnit;
|
|
public Image timerFillImage;
|
|
public Image iconImage;
|
|
|
|
public void Initialize(RuntimeFunctionUnit functionUnit)
|
|
{
|
|
this.functionUnit = functionUnit;
|
|
iconImage.sprite = functionUnit.data.icon != null ? functionUnit.data.icon : null;
|
|
}
|
|
|
|
public override void UpdateUI()
|
|
{
|
|
float fillAmount;
|
|
|
|
if (functionUnit.maxCooldown <= 0f)
|
|
{
|
|
fillAmount = 1f;
|
|
}
|
|
else
|
|
{
|
|
fillAmount = 1f - functionUnit.currentCooldown / functionUnit.maxCooldown;
|
|
}
|
|
|
|
timerFillImage.fillAmount = fillAmount;
|
|
}
|
|
}
|
|
} |