private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Key")) { AudioManager.Instance.playPickUpKeySound(); GameManager.Instance.KeyObtained(other.gameObject); return; } if (other.gameObject.CompareTag("Win")) { AudioManager.Instance.playBoostSound(); _boosting = true; GetComponentInChildren <CapsuleCollider>().enabled = false; GameManager.Instance.NextLevel(); return; } var turningZone = other.GetComponentInParent <TurningZone>(); if (turningZone != null) { zone = turningZone; } var finishZone = other.GetComponentInParent <FinishZone>(); if (finishZone != null) { GameManager.Instance.EndGame(); } controller.OnTriggerEnter(other); }
private void OnTriggerExit(Collider other) { var turningZone = other.GetComponentInParent <TurningZone>(); if (turningZone != null) { zone = null; } }