Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using TMPro;
- using UnityEngine.UI;
- public class Dialogue : MonoBehaviour
- {
- [SerializeField] private TMP_Text _phrase;
- [SerializeField] private DialogueNPC _npc;
- private int _currentIndex = -1;
- public int CurrentIndex => _currentIndex;
- public void NextPhrase(PlayerInventory inventory)
- {
- if (_currentIndex < _npc.GetPhrasesCount() - 1)
- {
- _currentIndex++;
- }
- _phrase.text = _npc.GetPhrase(_currentIndex);
- _npc.CheckInventory(inventory);
- }
- public void SetNPC(DialogueNPC npc)
- {
- _npc = npc;
- }
- public void ResetNPC()
- {
- _npc = null;
- }
- public void ResetPhrases()
- {
- _currentIndex = -1 ;
- }
- public DialogueNPC GetDialogueNpc()
- {
- return _npc;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement