void findingCombo3() { thisDir = whichDir.right; DetermineRotDir(); if (/*comboNum3Reached == false && */ (int)dialAngle <= dialNum3 + 5 && (int)dialAngle >= dialNum3 - 1) { print("Getting Close to the right number"); //TODO Add vibration/sound to indicate that the dial is nearing the correct number if ((int)dialAngle <= dialNum3 + 1 && (int)dialAngle >= dialNum3 - 1) { /*TODO Increase vibration/sound volume to indicate that the player has reached the correct number * If the player stops the dial in the correct position for a second, they will unlock the first combo number and be allowed to continue*/ if (comboStayTimer > 0.0f) { comboStayTimer = comboStayTimer - (1.0f * Time.deltaTime); } else if (comboStayTimer <= 0.0f) { //comboNum3Reached = true; currentState = lockState.unlocked; print("You found the THIRD DIGIT! DOOR UNLOCKED"); } } } else if ((int)dialAngle < dialNum3 - 1 && (int)dialAngle >= dialNum3 - 3) { puzzleAttempts++; currentState = lockState.failed; } else { comboStayTimer = 2.0f; } }
void OnEnable() { mainCam.enabled = false; camCom.enabled = true; myDial.transform.Rotate(0.0f, 0.0f, -dialAngle); currentState = lockState.findCombo1; }
void OnEnable() { solveState = lockState.inProgress; //Get the current state of the Laser Countdown Timer (to return to later), //then deactivate it while the player tries to solve the puzzle isTimerActive = LevelManager.timerState.ToString(); LevelManager.timerState = LevelManager.TimerOn.timerDeactivated; if (lockChoice == whichLock.rotaryDial) { gameObject.AddComponent <Lock_RotaryDial>(); //gameObject.GetComponent<Lock_RotaryDial> ().enabled = true; } else if (lockChoice == whichLock.tumblerLock) { } }
void DetermineRotDir() { if (thisDir == whichDir.right) { if (Input.GetAxis("Horizontal") < 0.0f) { puzzleAttempts++; currentState = lockState.failed; } } else if (thisDir == whichDir.left) { if (Input.GetAxis("Horizontal") > 0.0f) { puzzleAttempts++; currentState = lockState.failed; } } }
void dialFailed() { if (puzzleAttempts < 3) { myDial.transform.Rotate(0.0f, 0.0f, -dialAngle); print("Press SPACE TO RETRY" + " / Attempts Left: " + (3 - puzzleAttempts)); if (Input.GetKeyDown(KeyCode.Space)) { currentState = lockState.findCombo1; } } else if (puzzleAttempts >= 3) { print("Puzzle FAILED! DOOR LOCKED"); DestroyLockSetup(); mainCam.enabled = true; lockMan.solveState = LockManager.lockState.failed; //Upon doing this \/, the door CANNOT BE OPENED Destroy(this); } }
void Update() { RotateDial(); if (Input.GetKeyDown(KeyCode.Q)) { //This leaves the puzzle "unsolved" (and no longer "inProgress" for now). Later on, there will be alternate states for: currentState = lockState.unsolved; } if (Input.GetKeyDown(KeyCode.T)) { currentState = lockState.unlocked; } //TODO Set up an arrow sprite to show player which direction to rotate dial if (currentState == lockState.findCombo1) { findingCombo1(); } else if (currentState == lockState.findCombo2) { findingCombo2(); } else if (currentState == lockState.findCombo3) { findingCombo3(); } else if (currentState == lockState.unlocked) { dialSolved(); } else if (currentState == lockState.failed) { dialFailed(); } else if (currentState == lockState.unsolved) { dialUnsolved(); } }
void findingCombo2() { thisDir = whichDir.left; DetermineRotDir(); //TODO Does the dial need to pass 0 before going to the next digit? If so, just use a "passedZero" bool if (/*comboNum2Reached == false && */ (int)dialAngle >= dialNum2 - 5 && (int)dialAngle <= dialNum2 + 1) { print("Getting Close to the right number"); //TODO Add vibration/sound to indicate that the dial is nearing the correct number if ((int)dialAngle <= dialNum2 + 1 && (int)dialAngle >= dialNum2 - 1) { /*TODO Increase vibration/sound volume to indicate that the player has reached the correct number * If the player stops the dial in the correct position for a second, they will unlock the first combo number and be allowed to continue*/ if (comboStayTimer > 0.0f) { comboStayTimer = comboStayTimer - 1.0f * Time.deltaTime; } else if (comboStayTimer <= 0.0f) { //comboNum2Reached = true; currentState = lockState.findCombo3; print("You found the SECOND DIGIT"); } } } else if ((int)dialAngle > dialNum2 + 1 && dialAngle <= dialNum2 + 3) { puzzleAttempts++; currentState = lockState.failed; } else { comboStayTimer = 2.0f; } }
//Sets habitat map visuals for previewed lock state private void SetLockState(lockState newState) { if (newState == lockState.LOCK) { effectImage.enabled = true; effectImage.sprite = lockSprites[0]; effectImage.color = new Color32(255, 50, 35, 255); } else if (newState == lockState.PARTIAL) { effectImage.enabled = true; effectImage.sprite = lockSprites[1]; effectImage.color = new Color32(255, 240, 35, 255); } else if (newState == lockState.UNLOCK) { effectImage.enabled = true; effectImage.sprite = lockSprites[1]; effectImage.color = new Color32(35, 255, 50, 255); } else { effectImage.enabled = false; effectImage.sprite = null; effectImage.color = new Color32(255, 255, 255, 0); } }
//Sets Final Lock State based on Locomotion Lock State and Restriction Lock State private void SetLocks(lockState lockLoco, lockState lockRest) { Adaptation.restriction[] activeRestrictions = critter.GetRestrictions(); int currentRestrictionCount = CountRestrictions(activeRestrictions); bool EquippedLocoOK; SetLockState(lockState.NONE); if (lockLoco == lockState.LOCK || lockRest == lockState.LOCK) { SetLockState(lockState.LOCK); } else if (lockLoco == lockState.UNLOCK) { if (lockRest == lockState.UNLOCK) { SetLockState(lockState.UNLOCK); } else if(lockRest == lockState.PARTIAL) { SetLockState(lockState.PARTIAL); } else { if (currentRestrictionCount > 0) { SetLockState(lockState.PARTIAL); } else { SetLockState(lockState.UNLOCK); } } } else if (lockLoco == lockState.NONE) { EquippedLocoOK = HabitatSupportsAdaptationLocomotion(equippedEvo); if (EquippedLocoOK) { if (lockRest == lockState.UNLOCK) { SetLockState(lockState.UNLOCK); } else if (lockRest == lockState.PARTIAL) { SetLockState(lockState.PARTIAL); } } else { if (lockRest == lockState.UNLOCK) { SetLockState(lockState.PARTIAL); } else if (lockRest == lockState.PARTIAL) { SetLockState(lockState.PARTIAL); } } } }