40 lines
865 B
C#
40 lines
865 B
C#
using UnityEngine;
|
|
|
|
public class ActionUIHandler : MonoBehaviour
|
|
{
|
|
#region Statication
|
|
|
|
public static ActionUIHandler instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance != null && instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
instance = this;
|
|
}
|
|
|
|
#endregion
|
|
[Header("UI")]
|
|
[SerializeField] private Vector3 offset;
|
|
[SerializeField] private GameObject actionUI;
|
|
private Entity selectedEntity;
|
|
public void ShowUI(Entity target)
|
|
{
|
|
selectedEntity = target;
|
|
transform.position = Input.mousePosition + offset;
|
|
actionUI.SetActive(true);
|
|
}
|
|
public void HideUI()
|
|
{
|
|
actionUI.SetActive(false);
|
|
}
|
|
|
|
public void MoveEntity()
|
|
{
|
|
HideUI();
|
|
PlayerEntityMovement.instance.SelectEntity(selectedEntity);
|
|
}
|
|
}
|