public void PuzzleSolved() { currentJigsaw.solved = true; currentJigsaw.interactive = false; for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).GetChild(0).GetComponent <CanvasGroup>().blocksRaycasts = false; } currentJigsaw.GetComponent <MeshRenderer>().material.SetTexture("Texture2D_1066FD47", currentJigsaw.CompleteCoverSprite.texture); currentJigsaw.audioSource.clip = currentJigsaw.successSound; currentJigsaw.audioSource.Play(); currentJigsaw = null; sprites = null; Time.timeScale = 1; StartCoroutine("CloseJigsaw"); }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Cancel")) { currentJigsaw.audioSource.clip = currentJigsaw.openSound; currentJigsaw.audioSource.Play(); currentJigsaw = null; sprites = null; for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } Time.timeScale = 1; firstPersonController.enabled = true; firstPersonController.transform.GetChild(0).GetComponentInChildren <LightSwitch>().enabled = true; firstPersonController.m_MouseLook.SetCursorLock(true); transform.parent.gameObject.SetActive(false); } }