public void StartRespawn(GameObject _playerInRange) { if (OnPlayerFall != null) { OnPlayerFall.Invoke(this, _playerInRange); } }
// Update is called once per frame void Update() { foreach (var player in _players) { // -15 is the best, since player is in fog but when is falling to slow -5 is better if (player.transform.position.y < -5 && player.GetComponent <PlayerController>().isActiveAndEnabled) { if (OnPlayerFall != null) { OnPlayerFall.Invoke(this, player); } } } }
/// <summary> /// Fall detected event /// </summary> public void FallDetector_OnEnter(Collider collider) { if (collider.tag == "Player") { if (OnPlayerFall == null && playerSystem != null) { playerSystem.TeleportCharacter(teleporterEntry.transform.position); playerSystem.TakeDamage(10); } else { OnPlayerFall?.Invoke(this, collider); } } else if (collider.tag == "Ennemy") { // Kill the ennemy collider.GetComponent <EnnemySystem>().Kill(); } }