void Update() { if (currentQuest != null) { questUIPrompt(currentQuest); } if (currentTrader != null) { tradeUIPrompt(currentTrader); } if (interactable && Input.GetKeyDown(KeyCode.Mouse0) && npcmanager.currentNpc != null) { resetIndicator(); if (npcmanager.returnNPCType(npcmanager.currentNpc.NPC, 0)) { currentQuest = (NPCManager.QuestInfo)npcmanager.returnNPCData(npcmanager.currentNpc.NPC, 0); questUIPrompt(currentQuest); } else if (npcmanager.returnNPCType(npcmanager.currentNpc.NPC, 1)) { questStatusCheck((NPCManager.QuestInfo)npcmanager.returnNPCData(npcmanager.currentNpc.NPC, 1)); } else if (npcmanager.returnNPCType(npcmanager.currentNpc.NPC, 2)) { currentTrader = (NPCManager.Trader)npcmanager.returnNPCData(npcmanager.currentNpc.NPC, 2); traderInfo = currentTrader; tradeUIPrompt(currentTrader); } //local data record if (!recorded) { if (npcmanager.currentNpc.npcType == "Human") { GetComponent <gsheet_data>().sendData(3, 1); } else if (npcmanager.currentNpc.npcType == "Animal") { GetComponent <gsheet_data>().sendData(4, 1); } //local data record DataRecord.AddEvents(9, npcmanager.currentNpc.NPC.name); recorded = true; } } if (npcmanager.currentNpc == null) { recorded = false; } showQuestIndicator(); }
void tradeUIPrompt(NPCManager.Trader t) { PlayerMovement.canMove = false; tradeUI.SetActive(true); Title = GameObject.FindGameObjectWithTag("TradeTitle").GetComponent <TextMeshProUGUI>(); Detail = GameObject.FindGameObjectWithTag("TradeDetail").GetComponent <TextMeshProUGUI>(); Title.text = t.name; Detail.text = t.detail; t.accepted = true; tradeStatusCheck(t); }
public void decline() { if (currentTrader != null) { //local data record DataRecord.AddEvents(8, "Trader " + currentTrader.name + "'s Trade"); currentTrader.accepted = false; } //local data record if (currentQuest != null) { DataRecord.AddEvents(8, currentQuest.name + " Quest"); } Accepted = false; questUI.SetActive(false); tradeUI.SetActive(false); currentQuest = null; currentTrader = null; traderInfo = null; PlayerMovement.canMove = true; }
void tradeStatusCheck(NPCManager.Trader t) { int count = 0; if (t != null) { foreach (NPCManager.NPCItem i in t.requirement) { if (i.collected >= t.requirementCount) { count++; } } if (count == t.requirementCount) { if (Accepted) { TradeLog log = new TradeLog(); log.tradeID = t.id; log.tradeNPC = t.name; log.tradeDetail = t.detail; tradeLog.Add(log); StartCoroutine(t.DelayReset(2f)); Accepted = false; currentTrader = null; traderInfo = null; tradeUI.SetActive(false); PlayerMovement.canMove = true; } } else if (count != t.requirementCount) { Accepted = false; } } }