36 lines
1 KiB
C#
36 lines
1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class StatusIconUI : MonoBehaviour
|
|
{
|
|
public Image backgroundImage;
|
|
public Image statusImage;
|
|
public Text turnsText;
|
|
|
|
private BattleStatus status;
|
|
|
|
public void InitStatus(BattleStatus status) {
|
|
Sprite sprite = Resources.Load<Sprite>(GetStatusResourcePath(status));
|
|
this.statusImage.sprite = sprite;
|
|
}
|
|
|
|
public void InitBuff(BuffType buffType) {
|
|
Sprite sprite = Resources.Load<Sprite>(GetBuffResourcePath(buffType));
|
|
this.statusImage.sprite = sprite;
|
|
}
|
|
|
|
private static string GetStatusResourcePath(BattleStatus status) {
|
|
return "BattleIcons/StatusIcon" + status;
|
|
}
|
|
|
|
private static string GetBuffResourcePath(BuffType buffType) {
|
|
return "BattleIcons/BuffIcon" + buffType;
|
|
}
|
|
|
|
public void SetAmount(int amount, int index) {
|
|
this.turnsText.text = "" + amount;
|
|
this.transform.localPosition = new Vector2(-index * 22, 0);
|
|
}
|
|
}
|