private void OnRespawn(Vector3 respawnPosition, Spawnable.RespawnReason reason) { if ( reason == Spawnable.RespawnReason.Death && (!DebugSettings.Instance.DebugMode || !DebugSettings.Instance.DisableRevivalMinigame) ) { var instance = Instantiate(playerGhostPrefab, respawnPosition, Quaternion.identity) .GetComponentInChildren <PlayerGhost>(); instance.Register(_player, transform.position); } }
/** * <summary> * This method is called, if this object also has a <see cref="Spawnable"/> component and its * <see cref="Spawnable.OnRespawn"/> event is triggered. * * We use this event to manually check for platform contacts on respawn, since the physics event functions of * <see cref="Chasm"/> may be called before the event functions of this behavior. * However, we have to register contacts with <see cref="Platform"/> before <see cref="Chasm"/> does, so we directly * do it on respawn using this method. * </summary> */ private void OnRespawn(Vector3 respawnPosition, Spawnable.RespawnReason reason) { var colliderList = new List <Collider2D>(); var contactFilter = new ContactFilter2D(); contactFilter.NoFilter(); _collider.OverlapCollider(contactFilter, colliderList); foreach (var collider in colliderList) { OnTriggerEnter2D(collider); } }
public void OnRespawn(Vector3 respawnPosition, Spawnable.RespawnReason reason) { // if the player carries another player, release if (CarriesSomeone()) { ThrowThrowable(_carriedThrowable, Vector2.zero); } // if the player is carried by another player, release else if (_throwable.IsBeingCarried) { _throwable.Carrier.ThrowThrowable(_throwable, Vector2.zero); } if (_data.HealthPoints <= 0) { ChangeHealth(PlayerInfo.MAX_HEALTH_POINTS); } }