private void OnEnable() { start = transform.position; for (int i = 1; i <= 350; ++i) { float randX = Random.Range(0, radius); float randY = Random.Range(0, radius); float randZ = Random.Range(0, radius); if (i % 2 == 0) { randX *= -1; randY *= -1; randZ *= -1; } Vector3 vec = new Vector3(randX, randY, randZ); randX = Random.Range(0.0f, 359.99f); randY = Random.Range(0.0f, 359.99f); randZ = Random.Range(0.0f, 359.99f); Vector3 vec2 = new Vector3(randX, randY, randZ); Transform trans = transform.GetChild(0).GetChild(i % 5); PhoneScript phone = Instantiate(phonePrefab, trans, false); phone.transform.localPosition = vec; phone.transform.localRotation = Quaternion.Euler(vec2); Destroy(phone.GetComponent <BoxCollider>()); Destroy(phone.GetComponent <Rigidbody>()); int j = 0; if (i % 2 == 0) { j = 1; } else if (i % 3 == 0) { j = 2; } phone.ringType = j; float ting = Random.Range(0.0f, PhoneScript.ringLength); phone.timer = ting; phone.src.time = ting; } k = 0; }
IEnumerator Phase3() { playerLight.gameObject.SetActive(false); powerDown.Play(); int i = 0; ring2.Play(); foreach (Transform child in tempPhase3Phones) { PhoneScript phone = Instantiate(phonePrefab, child.position, child.rotation, phase3Phones); Destroy(phone.GetComponent <Rigidbody>()); Destroy(phone.GetComponent <AudioSource>()); phone.name = child.name; phone.ringType = i++; if (i > 2) { i = 0; } if (child.localPosition.y > 2.9f) { Destroy(phone.GetComponent <BoxCollider>()); } } Destroy(tempPhase3Phones.gameObject); StartCoroutine(Wait(ring2.clip.length)); while (waiting) { yield return(null); } phase3Phones.gameObject.SetActive(true); music[9].Play(); playerLight.gameObject.SetActive(true); playerLight.range = 9.89f; playerLight.intensity = 2.01f; spotlight.Play(); ring2.Play(); }
IEnumerator Phase5() { phase5 = true; holdingPhone = false; startPhase5 = false; StartCoroutine(FinalPhone()); while (finalPhone) { yield return(null); } bassDrop.Play(); StartCoroutine(SlowZoom()); while (bassDrop.isPlaying) { if (paused) { yield return(new WaitForSeconds(0.1f)); } yield return(null); } cam.backgroundColor = new Color(159.0f / 255.0f, 96 / 255.0f, 190.0f / 255.0f, 255f); house2 = GameObject.Find("House 2"); while (zooming) { yield return(null); } float spacer = 250; int bound = 4; for (int i = -bound; i < bound; ++i) { for (int j = -bound; j < bound; ++j) { for (int k = -bound; k < bound; ++k) { PhoneScript ps = Instantiate(phonePrefab, new Vector3(i * spacer, j * spacer, k * spacer), Quaternion.identity, phase5Phones.transform); Destroy(ps.GetComponent <BoxCollider>()); ps.GetComponent <AudioSource>().volume = 0.0f; Destroy(ps.GetComponent <Rigidbody>()); ps.transform.localScale = new Vector3(500, 500, 500); } } } music[10].Play(); phase5Lights.SetActive(false); floatingLights.SetActive(true); player.position = playerEndStart; controller.m_MouseLook.m_CameraTargetRot = new Quaternion(-0.1f, 0.0f, 0.0f, 1.0f); controller.m_MouseLook.m_CharacterTargetRot = new Quaternion(0.0f, -179.9f, 0.0f, -4.4f); phase5Phones.SetActive(true); controller.enabled = true; StopCoroutine(SlowZoom()); cam.fieldOfView = 60.0f; StartCoroutine(FloatPlayer()); house2.SetActive(false); godPhone.gameObject.SetActive(false); StartCoroutine(Wait(13.0f)); while (waiting) { yield return(null); } foreground.gameObject.SetActive(true); StartCoroutine(Wait(7.0f)); while (waiting) { yield return(null); } SceneManager.LoadScene("Menu"); }