more enemy stuff
This commit is contained in:
parent
3b60583c76
commit
d8c49317a3
235 changed files with 27781 additions and 3909 deletions
|
|
@ -1,17 +1,45 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StoredAbilityUpgradeUI : MonoBehaviour
|
||||
public class StoredAbilityUpgradeUI : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
|
||||
{
|
||||
[SerializeField] private Image icon;
|
||||
[SerializeField] private TextMeshProUGUI nameUI;
|
||||
[SerializeField] private TextMeshProUGUI countUI;
|
||||
|
||||
public AbilityUpgrade storedUpgrade;
|
||||
[HideInInspector] public Transform parentAfterDrag;
|
||||
public void SetUpgrade(AbilityUpgrade upgrade, int count)
|
||||
{
|
||||
//icon.sprite = upgrade.upgradeIcon;
|
||||
storedUpgrade = upgrade;
|
||||
nameUI.text = upgrade.name;
|
||||
countUI.text = $"x{count}";
|
||||
}
|
||||
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
parentAfterDrag = transform.parent;
|
||||
icon.raycastTarget = false;
|
||||
icon.transform.SetParent(transform.root);
|
||||
icon.transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
icon.transform.position = Input.mousePosition;
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
icon.raycastTarget = true;
|
||||
icon.transform.SetParent(parentAfterDrag);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Destroy(icon.gameObject);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue