using System.Collections; using System.Collections.Generic; using UnityEngine; public class Door : MonoBehaviour { public Animator _ani; public BoxCollider2D bx; public bool isOpen=false; public GameObject boss; private void Awake() { _ani = GetComponentInChildren(); bx = GetComponent(); boss = GameObject.FindWithTag("Boss"); } private void Update() { if(isOpen) { Debug.Log("¿ªÃÅ"); _ani.Play("activate"); StartCoroutine(nameof(Open)); } } private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Player")&&!isOpen) { UIManager.Instance.Show(); } } private IEnumerator Open() { yield return new WaitForSeconds(7f); bx.isTrigger = true; boss.GetComponentInChildren().SetBegin(true); isOpen=false; this.gameObject.SetActive(false); } }