using UnityEngine;
using TMPro;
public class AudioLogPickup : MonoBehaviour
{
public TextAsset audioLog;
private TextMeshProUGUI audioLogTooltip;
private ListOfAudioButtons audioLogList;
private PlayAudioLog playAudioLog;
private void Start()
{
audioLogTooltip = GameObject.Find("AudioLogTooltip").GetComponent();
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
Debug.Log(audioLog.name);
audioLogList = other.gameObject.GetComponent();
playAudioLog = other.gameObject.GetComponent();
if (!playAudioLog.hasAudioLog)
{
playAudioLog.hasAudioLog = true;
GameObject.Find("Warning").SetActive(false);
playAudioLog.currentAudioLog = audioLog;
}
playAudioLog.hasNewAudioLog = true;
if (!playAudioLog.isReading)
{
if (!playAudioLog.hasSeenOpenTip)
{
playAudioLog.hasSeenOpenTip = true;
audioLogTooltip.text = "You have a new audio log!\nPress \"P\" to listen";
}
else
{
audioLogTooltip.text = "You have a new audio log!";
}
}
playAudioLog.unheardAudioLogs.Insert(0, audioLog);
audioLogList.nameOfAudioLog = audioLog.name.ToString();
audioLogList.CreateButton(audioLog);
Destroy(gameObject);
}
}
}