void OnTriggerExit2D(Collider2D other) { Debug.Log("OnTriggerExit " + other.name + " " + other.tag); if (other.tag == "EnemyViewFrustrum") { EnemyDetectorComponent detector = other.gameObject.GetComponent <EnemyDetectorComponent>(); if (detector != null) { detector.NoDetectPlayer(this); } else { Debug.LogError("ViewDetector has no DetectorComponent"); } } }
void DetectorAlertResponse(EnemyDetectorComponent detector, PlayerController player) { if (detector.alerted) { Debug.Log(alertEvent); behavior.SendEvent(alertEvent); alerted = true; playerFound = player; } else { Debug.Log(lostEvent); alerted = false; behavior.SendEvent(lostEvent); } }