public void ResetPuzzle() { if (!solved) { puzzleWasReset = true; resetter.ResetRoom(); foreach (Box box in originalBoxList) { Destroy(box.gameObject); } accumulatedBoxes = accumulatedScore = 0; } }
public override void interact(Pickup pickup) { if (canReset) { GetComponentInChildren <Animator>().Play("ButtonPress"); Controller.ResetRoom(); pickup.characterController.dealDamage(2); canReset = false; } else { pickup.e_button_exception.flash_text(get_exception(0), 1); } }
IEnumerator StartLockDown(bool reset = false) { if (!reset) { state = LockDownState.preping; //Queue Doors //Queue Lights onEnter.Invoke(); //Queue Music //Queue UI Player.singleton.UI.SetActive(false); MusicManager.singleton.PlayTrack(trackBuildUp); lockdownAnnounce.SetActive(true); lockdownBackground.SetActive(true); yield return(new WaitForSeconds(3f)); Player.singleton.UI.SetActive(true); lockdownAnnounce.SetActive(false); lockdownBackground.SetActive(false); //Trigger conversation beforeConversation.Trigger(); beforeConversation.conversation.SetProgress(0); yield return(new WaitUntil(() => beforeConversation.conversation.Done())); Player.singleton.UI.SetActive(false); lockdownBackground.SetActive(true); lockdownTutorial1.SetActive(true); yield return(new WaitUntil(() => Input.GetButtonDown("Interact/Pickup"))); yield return(new WaitForSeconds(0.1f)); lockdownTutorial1.SetActive(false); lockdownTutorial2.SetActive(true); yield return(new WaitUntil(() => Input.GetButtonDown("Interact/Pickup"))); lockdownTutorial2.SetActive(false); lockdownBackground.SetActive(false); Player.singleton.UI.SetActive(true); } yield return(new WaitForSeconds(3f)); if (!reset) { MusicManager.singleton.QueueUpNextTrack(trackNormal); } //Queue Spawners foreach (BoxSpawner spawner in spawners) { spawner.TurnSpawnerOn(); } //Show Lockdown UI LockdownSystem.ShowUI(); LockdownSystem.UpdateUI(this); state = LockDownState.doing; yield return(new WaitUntil(() => spawnersEmpty == true || liveBoxCount > boxLimit)); //Target reached or Player fails if (liveBoxCount > boxLimit) { //Show UI saying the player lost //Wait a bit yield return(new WaitForSeconds(3f)); //Destroy all the boxes in the room resetter.ResetRoom(); //Reset the spawners foreach (BoxSpawner spawner in spawners) { spawner.ResetSpawner(); } //Put Player back at start of lockdown Player.singleton.transform.position = resetTransform.position; Player.singleton.myPickup.ClearInventory(); //Start Lockdown again LockdownSystem.ShowUI(false); liveBoxCount = 0; StartCoroutine(StartLockDown(true)); yield break; } state = LockDownState.finishing; LockdownSystem.ShowUI(false); //Unlock doors //Restore lights, music, doors etc. onComplete.Invoke(); MusicManager.singleton.QueueUpNextTrack(null); afterConversation.Trigger(); }