using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DialogueManager : MonoBehaviour {
public static DialogueManager Instance { get; set; }
public List<string> dialogueLines = new List<string>();
public string npcName;
public GameObject dialoguePanel;
void Awake () {
if (Instance != null && Instance != this) {
Destroy (gameObject);
}
else
{
Instance = this;
}
}
public void AddNewDialogue(string[] lines, string npcName)
{
dialogueLines = new List<string>();
foreach (string line in lines)
{
dialogueLines.Add(line);
}
this.npcName = npcName;
Debug.Log (dialogueLines.Count);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPC : Interactable {
public string dialogue;
public string Name;
public override void Interact()
{
DialogueManager.Instance.AddNewDialogue(dialogue); //getting error here
Debug.Log ("Interacting with NPC.");
}
}