private void SetRefrences() { questJornal = this.GetComponent <Quest_Jornal>(); characterStats = this.GetComponent <Character_Stats>(); if (nPC) { shopIconParent = GameObject.FindObjectsOfType <Shop_Icon_Parent>()[0].GetComponent <Transform>(); shopIconParent.GetComponentInParent <Shop_UI_Manager>().gameObject.SetActive(false); if (Object.FindObjectsOfType <Shop_Icon_Parent>().Length > 1) { Debug.LogError("TWO OR MORE SHOP_ICON_PARENTS DETECTED"); } } equipmentManager = this.GetComponent <Equipment_Manager>(); uiInventoryManager = GameObject.FindObjectOfType <UI_Inventory_Manager>(); }
private void SetNPCWordsAndAnswers(int theDialogueID) { if (theDialogueID == -1) { StopDialogue(); return; } currentDialougeState = theDialogueID; dialogueManger.SetNPCWords(sentances[currentSelfSwitch].dialogue[theDialogueID].sentence); int theResponses = 0; foreach (Response response in sentances[currentSelfSwitch].dialogue[theDialogueID].responces) { print(theResponses + " " + response.response); dialogueManger.SetAnswerBTNTText(theResponses, response.response); theResponses++; } dialogueManger.EnableDisableBoxes(sentances[currentSelfSwitch].dialogue[theDialogueID].responces.Length); if (sentances[currentSelfSwitch].dialogue[theDialogueID].nPCAction == NPCAction.Item) // Give item to player { playersInventory.AddItemToInventory(sentances[currentSelfSwitch].dialogue[theDialogueID].theItemToGiveOrTake, -1); SetNewSelfSwitch(sentances[currentSelfSwitch].dialogue[theDialogueID].selfSwitchToSwitchTo); //TODO ADD IF BAG IS FULL SOMTHING EG DROP } if (sentances[currentSelfSwitch].dialogue[theDialogueID].nPCAction == NPCAction.TakeItem) //Take Item from player { playersInventory.RemoveItemFromInventory(sentances[currentSelfSwitch].dialogue[theDialogueID].theItemToGiveOrTake, -1); } if (sentances[currentSelfSwitch].dialogue[theDialogueID].nPCAction == NPCAction.Quest) // Gives player a new quest { player.GetComponent <Quest_Jornal>().AddNewQuest(sentances[currentSelfSwitch].dialogue[theDialogueID].theQuestToGiveOrTake); SetNewSelfSwitch(sentances[currentSelfSwitch].dialogue[theDialogueID].selfSwitchToSwitchTo); } if (sentances[currentSelfSwitch].dialogue[theDialogueID].nPCAction == NPCAction.takeQuest) // Checks to see if the quest is complete { Quest_Jornal playerJournal = player.GetComponent <Quest_Jornal>(); if (playerJournal.IsQuestComplete(sentances[currentSelfSwitch].dialogue[theDialogueID].theQuestToGiveOrTake) == true) { SetNPCWordsAndAnswers(sentances[currentDialougeState].dialogue[theDialogueID].questSuccessLocalID); playerJournal.ResetQuestData(sentances[currentSelfSwitch].dialogue[theDialogueID].theQuestToGiveOrTake); playerJournal.RemoveQuest(sentances[currentSelfSwitch].dialogue[theDialogueID].theQuestToGiveOrTake); } else { SetNPCWordsAndAnswers(sentances[currentDialougeState].dialogue[theDialogueID].questFailedLocalID); } } if (sentances[currentSelfSwitch].dialogue[theDialogueID].nPCAction == NPCAction.OpenShop) { dialogueManger.CloseDialogueBox(); this.GetComponent <Shop_Manager>().OpenShop(); } if (sentances[currentSelfSwitch].dialogue[theDialogueID].selfSwitchToSwitchTo > 0) // Checks to selfswitch { SetNewSelfSwitch(sentances[currentSelfSwitch].dialogue[theDialogueID].selfSwitchToSwitchTo); //SetNPCWordsAndAnswers(0); //StopDialogue(); } }