Better status icon system
This commit is contained in:
parent
31cb8fe4c0
commit
515602b670
13 changed files with 464 additions and 250 deletions
28
Assets/Battle/UI/StatusIconUI.cs
Normal file
28
Assets/Battle/UI/StatusIconUI.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
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 Init(BattleStatus status) {
|
||||
this.status = status;
|
||||
Sprite sprite = Resources.Load<Sprite>(GetStatusResourcePath(status));
|
||||
this.statusImage.sprite = sprite;
|
||||
}
|
||||
|
||||
private static string GetStatusResourcePath(BattleStatus status) {
|
||||
return "BattleIcons/StatusIcon" + status;
|
||||
}
|
||||
|
||||
public void SetAmount(int amount, int index) {
|
||||
this.turnsText.text = "" + amount;
|
||||
this.transform.localPosition = new Vector2(-index * 22, 0);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue