27 lines
616 B
C#
27 lines
616 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class ShopKeeperInteractionRadius : MonoBehaviour
|
|
{
|
|
private bool playerNearby;
|
|
[SerializeField] private GameObject interactionIcon;
|
|
private void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
playerNearby = true;
|
|
interactionIcon.SetActive(true);
|
|
}
|
|
|
|
private void OnTriggerExit2D(Collider2D other)
|
|
{
|
|
playerNearby = false;
|
|
interactionIcon.SetActive(false);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (playerNearby && Input.GetKeyDown(KeyCode.E))
|
|
{
|
|
ShopManager.instance.OpenShopUI();
|
|
}
|
|
}
|
|
}
|