using Manager; using System.Collections; using System.Collections.Generic; using UnityEngine; public class UIlottertOpen : MonoBehaviour { private Animator animator; private bool isOpen=true; private void Awake() { animator = GetComponentInChildren(); } private void OnTriggerStay2D(Collider2D collision) { if (Input.GetKeyDown(KeyCode.E)&&isOpen) { Debug.Log("Open Box"); isOpen = false; animator.Play("Box"); SoundManager.Instance.PlaySound(SoundDefine.BoxOpen); StartCoroutine(nameof(Open)); } } private void OnTriggerExit2D(Collider2D collision) { StopCoroutine(nameof(Open)); } IEnumerator Open() { yield return new WaitForSeconds(1.2f); UIManager.Instance.Show(); } }