Scriptum/Assets/Scripts/REFACTORING/Application/Chest/ChestController.cs
2023-01-07 20:21:00 +01:00

32 lines
708 B
C#

using UnityEditor;
using UnityEngine;
public class ChestController : MonoBehaviour
{
public void Update()
{
}
private void OnTriggerStay2D(Collider2D collision)
{
if (collision.tag == "Player" && !gameObject.GetComponentInParent<ChestWrapper>().IsLocked)
{
ChestUIManager.Instance.CurrentChestName = gameObject.transform.parent.name;
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if (collision.tag == "Player" && ChestUIManager.Instance.CurrentChestName != null)
{
ChestUIManager.Instance.ClosePanel();
ChestUIManager.Instance.CurrentChestName = null;
}
}
}