public void finishButton() { // informing the changeScene script if we have won or not utility.startClickOnButtonSound(); Change.setHasWon(hasWon); Change.teleportToPauseRoom(true); }
// Update is called once per frame void Update() { if (CurrentCanvas == HelpCanvas0 || CurrentCanvas == HelpCanvas1 || CurrentCanvas == HelpCanvas2) { Instructions.gameObject.SetActive(true); Phone.gameObject.SetActive(false); PhoneManager.gameObject.SetActive(false); PhoneTable.gameObject.SetActive(false); jackNPC.gameObject.SetActive(false); } else if (CurrentCanvas == PhoneCanvas0) { Instructions.gameObject.SetActive(false); PhoneTable.gameObject.SetActive(true); if (first1 == true) { tableConfetti.Play(true); first1 = false; } } else if (CurrentCanvas == PhoneCanvas1) { // activating the objects needed with this canvas Phone.gameObject.SetActive(true); if (first2 == true) { tableConfetti.Play(true); first2 = false; } PhoneManager.gameObject.SetActive(true); // detect when we grab the phone grabbed = phoneScript.getGrabbed(); if (grabbed == true) { nextCanvas(PhoneCanvas2); } } else if (CurrentCanvas == PhoneCanvas2) { PhoneTable.gameObject.SetActive(false); // detect when we place the phone near the ear atEar = triggerPhone.getatEar(); if (atEar == true) { phoneScript.putInPocket(); nextCanvas(PhoneCanvas3); } } else if (CurrentCanvas == PhoneCanvas3) { // get confirm that the phone call is completed correctPhoneCall = phoneManagerScript.getCorrectPhoneCall(); if (correctPhoneCall == true) { nextCanvas(PhoneCanvas4); } } else if (CurrentCanvas == PhoneCanvas4) { // do nothing and waits for the Next push button } else if (CurrentCanvas == NPCCanvas0) { Phone.gameObject.SetActive(false); PhoneManager.gameObject.SetActive(false); jackNPC.gameObject.SetActive(true); if (first3 == true) { jackConfetti.Play(true); first3 = false; } } else if (CurrentCanvas == NPCCanvas1) { // detect when the user clicks on the npc and set the visibility of the canvas of interactions to false (is visible) visibility = npcInteractions.getVisibility(); if (visibility == false) { nextCanvas(NPCCanvas2); } } else if (CurrentCanvas == NPCCanvas2) { // detect when the player if (npcLogic.isCalling() == true) { nextCanvas(NPCCanvas3); } } else if (CurrentCanvas == NPCCanvas3) { // do nothing and waits for the Next push button } else if (CurrentCanvas == MoveObjectsCanvas0) { // display the two tables and the bread jackNPC.gameObject.SetActive(false); PhoneTable.gameObject.SetActive(true); BreadTable.gameObject.SetActive(true); Bread.gameObject.SetActive(true); BreadSafezone.gameObject.SetActive(true); if (first4 == true) { tableConfetti.Play(true); breadTableConfetti.Play(true); first4 = false; } if (pickUpScript.isPickedUp() == true) { nextCanvas(MoveObjectsCanvas1); } } else if (CurrentCanvas == MoveObjectsCanvas1) { if (placedScript.getPositioned() == true) { nextCanvas(MoveObjectsCanvas2); } } else if (CurrentCanvas == MoveObjectsCanvas2) { // do nothing and waits for the Next push button } else if (CurrentCanvas == SymbolsCanvas0) { PhoneTable.gameObject.SetActive(false); BreadTable.gameObject.SetActive(false); BreadSafezone.gameObject.SetActive(false); // do nothing and waits for the Next push button } else if (CurrentCanvas == SymbolsCanvas1) { // do nothing and waits for the Next push button } else if (CurrentCanvas == FinishCanvas) { // waits for Ok push button // we "won" the level and we want to communicate it to the changeScene script changeSceneScript.setHasWon(true); } }