this idiot forgot to commit an entire month's worth of code
This commit is contained in:
parent
c67146ea1a
commit
a3321d361c
51 changed files with 3644 additions and 84 deletions
27
Assets/Scripts/ShopKeeperInteractionRadius.cs
Normal file
27
Assets/Scripts/ShopKeeperInteractionRadius.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue