using System.Collections; using System.Collections.Generic; using Assets.HeroEditor.Common.Scripts.Common; using TMPro; using UnityEngine; public class WoodenSign : MonoBehaviour { public TextMeshProUGUI signText; // The block of text that pops up when near a sign private GameObject player; // The player private float signRange = 4f; // Range the player needs to be within the sign void Start(){ player = GameObject.FindGameObjectWithTag("Player"); // Find the player and set it } void Update(){ // Get the distance from the sign to the player float distance = Vector2.Distance(transform.position, player.transform.position); // If the player is within range of the sign, print the text; otherwise hide the text if (distance <= signRange){ signText.SetActive(true); } else { signText.SetActive(false); } } }