private IEnumerator TranslateToRoom() { // Set immutable translating = true; // Activate/Disactivate control of count down gui inSubStage = !inSubStage; // Stop count down if freezing bool on = cameraGrey.GetOn(); if (on) { countDown.SetOn(false); } // Trigger camera animation movableCamera.GetComponent <CameraToBlack>().on = true; // Set door used translationPoint.DisableDoor(); yield return(new WaitForSeconds(0.25f)); // Translate to other scene // transform.position = translatePosition.position; transform.position = translationPoint.translatePosition.position; // Camera set border movableCamera.SetBorder(translationPoint.cameraSource, translationPoint.cameraDestination); // Set immutable translating = false; }
// Activate object when player enter void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.tag == "Player") { countDown.SetActive(true); light.SetActive(true); stoppableObjects.SetActive(true); int childCount = stoppableObjects.transform.childCount; bool timeStop = cameraGrey.GetOn(); if (timeStop) { for (int childIndex = 0; childIndex < childCount; childIndex++) { stoppableObjects.transform.GetChild(childIndex).GetComponent <StoppableObject>().SwitchOnOrOff(false); } } // Sound GetComponent <AudioSource>().Play(); } }