private void OnTriggerEnter(Collider other) { if (other.name == "player" && isTriggered == false) { // Disable second-time triggering. isTriggered = true; // Dispaly the locked door. door.SetActive(true); // Play the door shutting audio. audioSource.PlayOneShot(audioDrag); Invoke("AudioPlayDoorShut", 1.0f); // Destroy sub-scene. mySceneManagerRef.DeleteSubScene(2); // Indicate the checkpoint has been reached.. GameManager.isCheckpointReached = true; // Save the game state pre-battle. SavePreBattle(); // Destroy the switch itself. Destroy(this.gameObject, 3.0f); } }
private void OnTriggerEnter(Collider other) { if (other.name == "player" && isTriggered == false) { // Disable second-time triggering. isTriggered = true; // Display the locked door. door.SetActive(true); // Play the door shutting audio. audioSource.PlayOneShot(audioDrag); Invoke("AudioPlayDoorShut", 1.0f); // Destroy sub-scene. mySceneManagerRef.DeleteSubScene(0); // Destroy the switch itself. Destroy(this.gameObject, 3.0f); } }