using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class MateriPenyakitGigi : Menu { [SerializeField] protected TextMeshProUGUI nameText; [SerializeField] protected TextMeshProUGUI descriptionText; [SerializeField] protected Image previewImage; protected MateriSelector MateriSelector; protected MateriSpec currentMateri; protected override void Awake() { base.Awake(); MateriSelector = GetComponent(); UpdateInfo(); } private void OnEnable() { UpdateInfo(); } public void UpdateInfo() { currentMateri = MateriSelector.GetCurrentMission(); if(currentMateri != null ) { nameText.text = currentMateri.Name; descriptionText.text = currentMateri.Description; previewImage.sprite = currentMateri.Image; } } public void OnNextPressed() { audioController.Instance.PlaySFX("TombolUmum", 0.5f); MateriSelector.IncrementIndex(); UpdateInfo(); } public void OnPreviousPressed() { audioController.Instance.PlaySFX("TombolUmum", 0.5f); MateriSelector.DecrementIndex(); UpdateInfo(); } }