스킬 버튼 동작 구현 테스트
This commit is contained in:
@@ -74,5 +74,17 @@ namespace TON
|
||||
|
||||
linkedCharactor.SkillAttack(skill.skillData.name);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach (var index in skillButtons.Keys)
|
||||
{
|
||||
ControllerUI_SkillButton skillButton = skillButtons.GetValueOrDefault(index);
|
||||
if (skillButton != null && skillButton.skillData != null)
|
||||
{
|
||||
// skillButton.SetCoolTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -9,8 +10,10 @@ namespace TON
|
||||
{
|
||||
|
||||
public SkillData skillData;
|
||||
public GameObject skillImage;
|
||||
public GameObject lockImage;
|
||||
[SerializeField] private TextMeshProUGUI coolTimeText;
|
||||
[SerializeField] private Image coolTimeDimd;
|
||||
[SerializeField] private GameObject skillIcon;
|
||||
[SerializeField] private GameObject lockImage;
|
||||
|
||||
[SerializeField]
|
||||
private SerializableDictionary<string, Sprite> skillSprite = new SerializableDictionary<string, Sprite>();
|
||||
@@ -19,12 +22,18 @@ namespace TON
|
||||
{
|
||||
Debug.Log($"Initalize :: {skillData.id}");
|
||||
this.skillData = skillData;
|
||||
skillImage.SetActive(true);
|
||||
skillImage.GetComponent<Image>().sprite = skillSprite.GetValueOrDefault(skillData.id, null);
|
||||
skillIcon.SetActive(true);
|
||||
skillIcon.GetComponent<Image>().sprite = skillSprite.GetValueOrDefault(skillData.id, null);
|
||||
lockImage.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public void SetCoolTime(float remain, float max)
|
||||
{
|
||||
coolTimeText.gameObject.SetActive(remain > 0f);
|
||||
coolTimeText.text = $"{Mathf.CeilToInt(remain)}s";
|
||||
coolTimeDimd.fillAmount = remain / max;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user