using System.Collections; using System.Collections.Generic; using UnityEngine; public class NPC : MonoBehaviour { private DialogueManager dm; private string colliderName; public Dialogue dialogue; private void Start() { dm = FindObjectOfType(); } private void OnTriggerStay(Collider other) { if(other.gameObject.name == "Player") { if (Input.GetKeyUp("e") && !dm.alreadyTalking) { TriggerDialogue(); } } } public void TriggerDialogue() { dm.StartDialogue(dialogue); } }