private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { coroutine = StartCoroutine(CoTargetDistance()); } } void OnTriggerExit(Collider other) { if (other.CompareTag("Player")) { if (coroutine != null) { StopCoroutine(coroutine); } } } IEnumerator CoTargetDistance() { while (true) { if(targetDistance <= attackDistance) { EventManager.Dispatch(GameEventType.GameOver, false); break; } yield return null; } }
+ Boss Asset(Mimic) 최적화
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("Player")) { EventManager.Dispatch(GameEventType.GameOver, false); } }