Advertisement
evelynshilosky

DialogueSystem - Part 27

Dec 12th, 2023
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class DialogueSystem : MonoBehaviour
  8. {
  9.  
  10.     public static DialogueSystem Instance { get; set; }
  11.  
  12.     public TextMeshProUGUI dialogueText;
  13.  
  14.     public Button option1BTN;
  15.     public Button option2BTN;
  16.  
  17.     public Canvas dialogueUI;
  18.  
  19.     public bool dialogueUIActive;
  20.  
  21.  
  22.     private void Awake()
  23.     {
  24.         if (Instance != null && Instance != this)
  25.         {
  26.             Destroy(gameObject);
  27.         }
  28.         else
  29.         {
  30.             Instance = this;
  31.         }
  32.     }
  33.  
  34.     public void OpenDialogueUI()
  35.     {
  36.         dialogueUI.gameObject.SetActive(true);
  37.         dialogueUIActive = true;
  38.  
  39.         Cursor.lockState = CursorLockMode.None;
  40.         Cursor.visible = true;
  41.     }
  42.  
  43.     public void CloseDialogueUI()
  44.     {
  45.         dialogueUI.gameObject.SetActive(false);
  46.         dialogueUIActive = false;
  47.  
  48.         Cursor.lockState = CursorLockMode.Locked;
  49.         Cursor.visible = false;
  50.  
  51.     }
  52.  
  53.  
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement