void TalkWithNPC(Collider2D collision) { // Opens Dialogue Manager and uses NPC's first line if (!dMan.bDialogueActive) { dMan.portPic = portPic; dMan.dialogueLines = dialogueLines; dMan.ShowDialogue(); // Activates Options Holder if any options if (GetComponent <OptionsHolder>()) { GetComponent <OptionsHolder>().PrepareOptions(); } } // Stop NPC movement if (transform.parent.GetComponent <NPCMovement>()) { transform.parent.GetComponent <NPCMovement>().bCanMove = false; } // NPC looks at player if there's an animation/animator if (anim && collision) { if (anim.GetBool("bIsSitting")) { OrientSittingNPC(collision); } else if (anim.GetBool("bIsVogging")) { OrientVoggingNPC(collision); } else { OrientNPC(collision); } } // Stop UI controls / actions touches.bAaction = false; // Run any actions scriptMan.DialogueAction(action); if (bActionOnClose) { scriptMan.ActionOnClose(action); } }
public void EndQuest() { if (!bHasEnded) { dMan.portPic = portPic; qMan.ShowQuestText(endText); qMan.questsEnded[questNumber] = true; bHasEnded = true; // Run any actions if (bActionOnClose) { sMan.ActionOnClose(action); } } }
private void OnTriggerEnter2D(Collider2D collision) { // Drives NPC interaction if (collision.gameObject.CompareTag("Player")) { // DC TODO 02/13/19 -- Throws an error if a player saves & loads with in an NPC's dialogue zone // Need to identify order of execution or utilize another variable to prevent if (!qMan.questsCollected[questNumber]) { // Bool set on GameObject directs NPC interaction if (bBeginQuest && !qMan.questsStarted[questNumber]) { // Stop NPC movement if (transform.parent.GetComponent <NPCMovement>()) { transform.parent.GetComponent <NPCMovement>().bCanMove = false; } // NPC looks at player if there's an animation/animator if (npcAnim) { if (npcAnim.GetBool("bIsSitting")) { OrientSittingNPC(collision); } else if (npcAnim.GetBool("bIsVogging")) { OrientVoggingNPC(collision); } else { OrientNPC(collision); } } // Quest Text qMan.quests[questNumber].BeginQuest(); // Run any actions scriptMan.QuestAction(action); if (bActionOnClose) { scriptMan.ActionOnClose(action); } } if (bEndQuest && !qMan.questsEnded[questNumber]) { // Stop NPC movement if (transform.parent.GetComponent <NPCMovement>()) { transform.parent.GetComponent <NPCMovement>().bCanMove = false; } // NPC looks at player if there's an animation/animator if (npcAnim) { if (npcAnim.GetBool("bIsSitting")) { OrientSittingNPC(collision); } else if (npcAnim.GetBool("bIsVogging")) { OrientVoggingNPC(collision); } else { OrientNPC(collision); } } // Quest Text qMan.quests[questNumber].EndQuest(); // Run any actions scriptMan.QuestAction(action); if (bActionOnClose) { scriptMan.ActionOnClose(action); } } } } }