using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Assets.Scripts { public class NPC : MonoBehaviour { bool hasQuest = true; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void interact() { if (hasQuest) { GameObject.Find("UIHandler").GetComponent().showMessage("SUCCESS;"+TextHandler.getText("gotQuest")); GameObject.Find("QuestLog").GetComponent().addQuest(); hasQuest = false; } else { GameObject.Find("UIHandler").GetComponent().showMessage("ERROR;"+TextHandler.getText("noQuest")); } GameObject.Find("QuestLog").GetComponent().removeQuests(); } public bool receivedQuest(){ return !hasQuest; } public void loadQuest(string receivedQuest){ this.hasQuest = !bool.Parse(receivedQuest); } public string saveNPC(){ string result = ""; result = result + FileHandler.generateJSON("objectname", "\"" + name + "\","); result = result + FileHandler.generateJSON("receivedQuest", "\"" + !hasQuest + "\""); return result; } } }