Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- public class NPC : MonoBehaviour
- {
- public bool playerInRange;
- public bool isTalkingWithPlayer;
- private void OnTriggerEnter(Collider other)
- {
- if (other.CompareTag("Player"))
- {
- playerInRange = true;
- }
- }
- private void OnTriggerExit(Collider other)
- {
- if (other.CompareTag("Player"))
- {
- playerInRange = false;
- }
- }
- public void StartConversation()
- {
- isTalkingWithPlayer = true;
- print("Conversation Started");
- DialogueSystem.Instance.OpenDialogueUI();
- DialogueSystem.Instance.dialogueText.text = "Hello There";
- DialogueSystem.Instance.option1BTN.transform.Find("Text (TMP)").GetComponent<TextMeshProUGUI>().text = "Bye";
- DialogueSystem.Instance.option1BTN.onClick.AddListener(() => {
- DialogueSystem.Instance.CloseDialogueUI();
- isTalkingWithPlayer = false;
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement