Assets/Scripts/Overworld/Dialogue/NPC.cs (view raw)
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public abstract class NPC : MonoBehaviour
6{
7 private DialogueManager dm;
8 private string colliderName;
9 public Dialogue dialogue;
10
11 private void Start()
12 {
13 dm = FindObjectOfType<DialogueManager>();
14 }
15
16
17 private void OnTriggerStay(Collider other)
18 {
19 if(other.gameObject.name == "Player")
20 {
21 if (Input.GetKeyUp("e") && !dm.alreadyTalking)
22 {
23 TriggerDialogue();
24 }
25 }
26
27 }
28
29 public void TriggerDialogue()
30 {
31 dm.StartDialogue(this);
32 }
33
34 public abstract void actionAfterDialogue();
35}