using System; using Ktyl.Util; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; public class PickUpDisplay : MonoBehaviour { public bool paused => _paused; [SerializeField] private static bool _paused; [SerializeField] private GameObject artefactUI; [SerializeField] private Text artefactText; [SerializeField] private DialogueSystem dialogue; [SerializeField] private ArtefactSystem artefacts; [SerializeField] private ArtefactPreview _preview; [SerializeField] private GameEvent _uiOpen; [SerializeField] private GameEvent _uiClose; private Artefact chosenArtefact; private void Start() { EventHandler.current.onArtefactUI += PopUpOn; } private void Update() { var artefact = artefacts.GetNearbyArtefact(); if (!artefact) return; chosenArtefact = artefact; } public void PopUpOn() { _paused = true; artefactUI.SetActive(true); artefactText.text = chosenArtefact.Name; // inputSettings.updateMode = (InputSettings.UpdateMode)1; dialogue.PlayLine( chosenArtefact.dialogueKey ); _preview.Preview( chosenArtefact.Prefab ); _uiOpen.Raise(); } public void PopUpOff() { _paused = false; artefactUI.SetActive( false ); // inputSettings.updateMode = (InputSettings.UpdateMode)2; chosenArtefact = null; _uiClose.Raise(); } }