38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class AllyUpgrade : MonoBehaviour, IPointerClickHandler
|
|
{
|
|
[SerializeField]
|
|
private GameObject upgradeUI;
|
|
[SerializeField]
|
|
private List<Ally> upgradeList = new List<Ally>();
|
|
private GameObject _instance = null;
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
if (eventData.button == 0) //Left click
|
|
{
|
|
Debug.Log("Event clicked...");
|
|
if (!_instance)
|
|
{
|
|
Debug.Log(transform.position);
|
|
_instance = Instantiate(upgradeUI, transform.position, Quaternion.identity);
|
|
GameObject upgradeParent = _instance.transform.GetChild(0).gameObject;
|
|
for (int i = 0; i < upgradeParent.transform.childCount; i++)
|
|
{
|
|
GameObject upgradeEnfant = upgradeParent.transform.GetChild(i).gameObject;
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Destroy(_instance);
|
|
Debug.Log("Destroyed....");
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|