Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- public class GameManager : MonoBehaviour
- {
- public GameObject DialogueObject;
- public TextMeshProUGUI characterNameText;
- public TextMeshProUGUI dialogText;
- public System.Action dialogOnFinishAction;
- private void Awake()
- {
- ShowDialog("some text", "some text", null);
- }
- public void ShowDialog(string CharacterName, string Text, System.Action onFinish)
- {
- characterNameText.text = CharacterName;
- dialogText.text = Text;
- onFinish = dialogOnFinishAction;
- DialogueObject.SetActive(true);
- }
- // Start is called before the first frame update
- void Start()
- {
- DialogueObject.SetActive(false);
- }
- // Update is called once per frame
- void Update()
- {
- if ((Input.GetKeyDown(KeyCode.KeypadEnter)))
- {
- if(dialogOnFinishAction != null)
- {
- return;
- }
- else{
- System.Action action = dialogOnFinishAction;
- dialogText = null;
- action();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement