reworked interactions, fixed health depleting from testing

This commit is contained in:
TAASONI3
2023-12-29 17:29:03 +01:00
parent 661aa6704b
commit f57389e8a4
42 changed files with 325 additions and 105 deletions

View File

@@ -0,0 +1,43 @@
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;
}
}
}