using UnityEngine; // 유니티 엔진의 기본 기능을 불러올거에요 -> UnityEngine을 public class BossZoneTrigger : MonoBehaviour // 클래스를 선언할거에요 -> MonoBehaviour를 상속받는 BossZoneTrigger를 { [SerializeField] private NorcielBoss boss; // 변수를 선언할거에요 -> 깨울 보스 스크립트(NorcielBoss)를 boss에 [SerializeField] private GameObject fogWall; // 변수를 선언할거에요 -> 입구를 막을 안개벽 오브젝트를 fogWall에 private bool hasTriggered = false; // 변수를 초기화할거에요 -> 이미 발동했는지 여부를 거짓(false)으로 private void OnTriggerEnter(Collider other) // 함수를 실행할거에요 -> 무언가가 트리거에 닿았을 때 OnTriggerEnter를 { // 이미 발동했거나, 플레이어가 아니면 무시 if (hasTriggered) return; // 조건이 맞으면 중단할거에요 -> 이미 발동했다면(hasTriggered가 참이면) if (other.CompareTag("Player")) // 조건이 맞으면 실행할거에요 -> 닿은 물체의 태그가 "Player"라면 { hasTriggered = true; // 상태를 바꿀거에요 -> 발동 상태를 참(true)으로 // 1. 보스 깨우기 if (boss != null) boss.StartBossBattle(); // 조건이 맞으면 실행할거에요 -> 보스가 연결되어 있다면 전투 시작 함수(StartBossBattle)를 // 2. 도망 못 가게 입구 막기 (선택) if (fogWall != null) fogWall.SetActive(true); // 조건이 맞으면 실행할거에요 -> 안개벽이 연결되어 있다면 활성화(true)를 // 3. 이 트리거는 할 일 다 했으니 끄기 // gameObject.SetActive(false); // 바로 끄면 안개도 꺼질 수 있으니 주의 } } }