/// <summary> /// Teleports whatever enters the portal to a new destination /// </summary> protected override void Teleport(Collider2D collider) { // if the teleporter has a destination, we move the colliding object to that destination if (Destination != null) { LevelManager.Instance.FadeIn(); collider.transform.position = Destination.transform.position; _ignoreList.Remove(collider.transform); Destination.AddToIgnoreList(collider.transform); // we trigger splashs at both portals locations // Splash(); // Destination.Splash(); _character = collider.GetComponent <Character>(); _character.Freeze(); StartCoroutine(TeleportEnd()); //Deactivate the room we just left if (RoomToTurnOff != null) { RoomToTurnOff.SetActive(false); } if (SecondaryRoomToTurnOff != null) { SecondaryRoomToTurnOff.SetActive(false); } //respawn enemies a few rooms away RespawnEnemies(); } }
/// <summary> /// Teleports whatever enters the portal to a new destination /// </summary> protected override void Teleport(Collider2D collider) { // if the teleporter has a destination, we move the colliding object to that destination if (Destination != null) { LevelManager.Instance.FadeIn(); collider.transform.position = Destination.transform.position; _ignoreList.Remove(collider.transform); Destination.AddToIgnoreList(collider.transform); // we trigger splashs at both portals locations // Splash(); // Destination.Splash(); _character = collider.GetComponent <Character>(); _character.Freeze(); StartCoroutine(TeleportEnd()); //respawn enemies a few rooms away //RespawnEnemies(); //if boss health was lowered before player death, restore it here. if (BossHealth != null) { if (BossHealth.CurrentHealth > 0) { RestoreBossHealth(); } } if (EnteringBossRoom) { BackgroundMusic.Instance.PlayBossMusic(); } if (EnteringChillRoom) { BackgroundMusic.Instance.PlayChillRoomMusic(); } if (EnteringBonusRoom1) { BackgroundMusic.Instance.PlayBonusRoom1Music(); } if (EnteringBonusRoom2) { BackgroundMusic.Instance.PlayBonusRoom2Music(); } if (EnteringBonusRoom3) { BackgroundMusic.Instance.PlayBonusRoom3Music(); } if (LeavingBossRoom || LeavingChillRoom) { BackgroundMusic.Instance.PlayBackgroundMusic(); } } }