43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Assets.Scripts.InteractableObjects
|
|
{
|
|
public class NPC : InteractableObject
|
|
{
|
|
bool hasQuest = true;
|
|
|
|
public override void handleInteraction(GameObject player)
|
|
{
|
|
keepAlive = true;
|
|
if (hasQuest)
|
|
{
|
|
GameObject.Find("UIHandler").GetComponent<UIHandler>().showMessage("SUCCESS;"+TextHandler.getText("gotQuest"));
|
|
GameObject.Find("QuestLog").GetComponent<QuestLog>().addQuest();
|
|
hasQuest = false;
|
|
}
|
|
else
|
|
{
|
|
GameObject.Find("UIHandler").GetComponent<UIHandler>().showMessage("ERROR;"+TextHandler.getText("noQuest"));
|
|
}
|
|
GameObject.Find("QuestLog").GetComponent<QuestLog>().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;
|
|
}
|
|
}
|
|
} |