Do not bundle multiple buffs in UI
This commit is contained in:
parent
034e6beca6
commit
58da527ad5
3 changed files with 32 additions and 16 deletions
|
|
@ -10,15 +10,19 @@ public class StatusIconUI : MonoBehaviour
|
|||
public Text turnsText;
|
||||
|
||||
private BattleStatus status;
|
||||
private Buff buff;
|
||||
|
||||
public void InitStatus(BattleStatus status) {
|
||||
this.status = status;
|
||||
Sprite sprite = Resources.Load<Sprite>(GetStatusResourcePath(status));
|
||||
this.statusImage.sprite = sprite;
|
||||
}
|
||||
|
||||
public void InitBuff(BuffType buffType) {
|
||||
Sprite sprite = Resources.Load<Sprite>(GetBuffResourcePath(buffType));
|
||||
public void InitBuff(Buff buff) {
|
||||
this.buff = buff;
|
||||
Sprite sprite = Resources.Load<Sprite>(GetBuffResourcePath(buff.Type));
|
||||
this.statusImage.sprite = sprite;
|
||||
this.SetNumber(buff.Amount);
|
||||
}
|
||||
|
||||
private static string GetStatusResourcePath(BattleStatus status) {
|
||||
|
|
@ -29,8 +33,18 @@ public class StatusIconUI : MonoBehaviour
|
|||
return "BattleIcons/BuffIcon" + buffType;
|
||||
}
|
||||
|
||||
public void SetAmount(int amount, int index) {
|
||||
this.turnsText.text = "" + amount;
|
||||
public void UpdateStatusAmount(int amount) {
|
||||
if (this.status == BattleStatus.None) {
|
||||
throw new System.Exception();
|
||||
}
|
||||
this.SetNumber(amount);
|
||||
}
|
||||
|
||||
public void SetPosition(int index) {
|
||||
this.transform.localPosition = new Vector2(-index * 22, 0);
|
||||
}
|
||||
|
||||
private void SetNumber(int number) {
|
||||
this.turnsText.text = "" + number;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue