a ui (singular)
This commit is contained in:
parent
5776d5e889
commit
7b151c1a53
7 changed files with 1201 additions and 5 deletions
40
Assets/Scripts/ActionUIHandler.cs
Normal file
40
Assets/Scripts/ActionUIHandler.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue