47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class QuestMenuItemController : MonoBehaviour, IPointerClickHandler {
|
|
[SerializeField] public TextMeshProUGUI questNameText;
|
|
[SerializeField] public TextMeshProUGUI questLevelText;
|
|
[SerializeField] public TextMeshProUGUI questProgressText;
|
|
|
|
[SerializeField] public AudioClip clickAudioClip;
|
|
|
|
private PlayerMovement playerMovement;
|
|
|
|
private QuestID questID;
|
|
private NpcController npcController;
|
|
|
|
public void OnPointerClick(PointerEventData eventData) {
|
|
if (eventData.button.Equals(PointerEventData.InputButton.Left)) {
|
|
playerMovement.controller.PlaySound(clickAudioClip);
|
|
npcController.QuestInteract(questID);
|
|
}
|
|
}
|
|
|
|
public void Setup(QuestID questID, NpcController npcController, string progress) {
|
|
this.questID = questID;
|
|
this.npcController = npcController;
|
|
Quest quest = (Quest)QuestInfo.quests[questID];
|
|
questNameText.text = quest.name;
|
|
questLevelText.text = quest.prerequisites.minimumLevel.ToString();
|
|
questProgressText.text = progress;
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Awake() {
|
|
playerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|