36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MinionBar : MonoBehaviour {
|
|
|
|
public Object[] minionTypes;
|
|
public GameObject minionIconPrefab;
|
|
|
|
MinionIcon[] minionIcons;
|
|
int currentIndex;
|
|
|
|
public void Start() {
|
|
minionIcons = new MinionIcon[minionTypes.Length];
|
|
for (int i=0; i<minionTypes.Length; ++i) {
|
|
GameObject newIconObj = Instantiate(minionIconPrefab, transform);
|
|
minionIcons[i] = newIconObj.GetComponent<MinionIcon>();
|
|
// minionIcons[i].icon = minionTypes.icon; // TODO
|
|
minionIcons[i].indexInMinionList = i;
|
|
minionIcons[currentIndex].UnSelect();
|
|
}
|
|
minionIcons[currentIndex].Select();
|
|
}
|
|
|
|
public void ChangeSelectedIcon(int delta) {
|
|
minionIcons[currentIndex].UnSelect();
|
|
currentIndex = (currentIndex + delta) % minionTypes.Length;
|
|
minionIcons[currentIndex].Select();
|
|
}
|
|
|
|
public Object GetCurrentMinion() {
|
|
return minionTypes[currentIndex];
|
|
}
|
|
|
|
}
|