37 lines
895 B
C#
37 lines
895 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Assertions;
|
|
|
|
public class MoneyManager : MonoBehaviour
|
|
{
|
|
public GameObject[] ShopButtons;
|
|
public TMP_Text[] MoneyTexts;
|
|
|
|
private void OnEnable()
|
|
{
|
|
for (int i = 0; i < ShopButtons.Length; i++)
|
|
{
|
|
var eventScript = ShopButtons[i].GetComponentInChildren<UITooltips>();
|
|
eventScript.ButtonIndex = i;
|
|
|
|
eventScript.OnClick += OnShopButtonClicked;
|
|
}
|
|
}
|
|
|
|
private void OnShopButtonClicked(int index)
|
|
{
|
|
Assert.AreNotEqual(index, -1, "Shop button not init-ed with index");
|
|
|
|
print("Button clicked: " + index);
|
|
}
|
|
}
|
|
|
|
|
|
[CreateAssetMenu(fileName = "New TowerCollection", menuName = "Tower Defense/Tower Collection")]
|
|
public class TowerCollection : ScriptableObject
|
|
{
|
|
public Tower[] Towers;
|
|
}
|