private void OnTriggerExit(Collider other) { if (other.tag == "Player") { GCP03.isInQuestion = false; GameRoot.ShowTips("", false, false); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { GCP03.isInQuestion = true; GameRoot.ShowTips("Please press \"E\" to answer the question", true, false); } }
private void OnTriggerExit(Collider other) { if (other.tag == "Player") { GameRoot.ShowTips("Press \"E\" to trigger the switch", false, false); //GCP03.isChoosing = false; } }
public void EnterMenu() { resourceService.AsynLoadScene(Constants.menuSceneName, () => { GameRoot.ShowTips("", false, false); titleWindow.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgMenu, true); }); }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { GCP01.isInMast = true; GameRoot.ShowTips("Press \"E\" to grab the mast", true, false); } }
private void OnTriggerExit(Collider other) { if (other.tag == "Player") { playerController.isEnterExit = false; GameRoot.ShowTips("", false, false); } }
private void Update() { if (isEnterExit) { if (Input.GetKeyDown(KeyCode.E)) { GameRoot.ShowTips("", false, false); GameRoot.instance.puzzleSystem.EnterPuzzle(sceneName); } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { GameRoot.ShowTips("Press \"E\" to trigger the switch", true, false); //GCP03.isChoosing = true; //GCP03.rx = spanValue.x; //GCP03.ry = spanValue.y; //GCP03.rz = spanValue.z; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (questionNum != 0) { GameRoot.ShowTips("Press \"E\" to trigger the question", true, false); GCP01.isInQues = true; GCP01.SendConstrains(defaultScalar, defaultX, defaultY, defaultZ, questionNum); } } }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Player") { if (pressedE == null) { pressedE = tutorialWindow.pressE; } GameRoot.ShowTips("", false, false); Text.SetActive(false); } }
//used to trigger UI private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Player") { vectorText.gameObject.SetActive(false); //GCP02.currentVector = null; GCP02.isCannonTrigger = false; //---------------------------------New Tips Function-------------------------------------- GameRoot.ShowTips("", false, false); //-------------------------------------------------------------------------------------------- } }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Player") { text.gameObject.GetComponent <TextMesh>().color = Color.black; brackets.gameObject.GetComponent <TextMesh>().color = Color.black; GCP02.isCannonballTrigger = false; //---------------------------------New Tips Function-------------------------------------- GameRoot.ShowTips("", false, false); //-------------------------------------------------------------------------------------------- } }
public void EnterPuzzle(string puzzleName) { resourceService.AsynLoadScene(puzzleName, () => { CloseAllWindow(); GameRoot.ShowTips("", false, false); switch (puzzleName) { case Constants.menuSceneName: try { DialogueManager.instance.ResetAll(); } catch { } titleWindow.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgMenu, true); break; case Constants.mainSceneName: mainWindow.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgMain, true); break; case Constants.puzzle01SceneName: puzzle01Window.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgPuzzle1, true); break; case Constants.puzzle02SceneName: puzzle02Window.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgPuzzle2, true); break; case Constants.puzzle03SceneName: puzzle03Window.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgPuzzle3, true); break; case Constants.creditSceneName: creditsWindow.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgCredit, true); break; case Constants.tutorialSceneName: tutorialWindow.SetWindowState(true); audioService.PlayBgMusic(Constants.audioBgTutorial, true); break; } }); }
private void OnTriggerStay(Collider other) { if (other.tag == "Player") { if (!GCP01.isTriggerQuestion) { GameRoot.ShowTips("Press \"E\" to trigger the question", true, false); } else { GameRoot.ShowTips("", false, false); } } }
private void OnTriggerStay(Collider other) { if (other.tag == "Player") { if (!GCP01.isTriggerMast) { GameRoot.ShowTips("Press \"E\" to grab the mast", true, false); } else { GameRoot.ShowTips("", false, false); } } }
//used to trigger UI private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { Debug.Log("vector" + vector[0] + ", " + vector[1]); vectorText.gameObject.SetActive(true); GCP02.currentVector = vector; GCP02.isCannonTrigger = true; //---------------------------------New Tips Function-------------------------------------- GameRoot.ShowTips("Press \"E\" to pick the Cannon", true, false); //-------------------------------------------------------------------------------------------- } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { if (tutorialWindow == null) { tutorialWindow = GameObject.FindGameObjectWithTag("TutorialWindow").GetComponent <TutorialWindow>(); } if (pressedE == null) { pressedE = tutorialWindow.pressE; } GameRoot.ShowTips("Press \"E\" to select", true, false); Text.SetActive(true); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { if (GCP02.ActiveBoat == 0) { transform.values = DBP02.transforms0[index].values; } else if (GCP02.ActiveBoat == 1) { transform.values = DBP02.transforms1[index].values; } else if (GCP02.ActiveBoat == 2) { transform.values = DBP02.transforms2[index].values; } else if (GCP02.ActiveBoat == 3) { transform.values = DBP02.transforms3[index].values; } else if (GCP02.ActiveBoat == 4) { transform.values = DBP02.transforms4[index].values; } else { transform.values = DBP02.transforms5[index].values; } Debug.Log("Matrix" + index + ": " + transform.values[0] + ", " + transform.values[1] + ", " + transform.values[2] + ", " + transform.values[3]); text.gameObject.GetComponent <TextMesh>().color = Color.yellow; brackets.gameObject.GetComponent <TextMesh>().color = Color.yellow; GCP02.currentTransformMatrix = transform.values; GCP02.isCannonballTrigger = true; //---------------------------------New Tips Function-------------------------------------- GameRoot.ShowTips("Press \"E\" to pick the Cannon Ball", true, false); //-------------------------------------------------------------------------------------------- } }
void Update() { if (player.transform.position.x - previousPosition.x < 0.01 && player.transform.position.y - previousPosition.y < 0.01 && player.transform.position.y - previousPosition.y < 0.01) { timer += (int)Time.deltaTime + 1; if (timer == 1200) { GameRoot.ShowTips("Press 'R' to reset position.", true, false); } } else { timer = 0; } if (Input.GetKeyDown(KeyCode.R)) { player.transform.position = startPosition; GameRoot.ShowTips("", true, false); } previousPosition = player.transform.position; }
private void Update() { if (Input.GetKeyDown(KeyCode.R)) { player.transform.localPosition = startPosition; GameRoot.instance.IsLock(false); P03W.ShowChoicePanel(false); isTriggerQuestion = false; GameRoot.ShowTips("", true, false); } if (isRotate) { if (Mathf.Abs(diffRotation.x) <= 2f && Mathf.Abs(diffRotation.y) <= 2f && Mathf.Abs(diffRotation.z) <= 2f) { plane.transform.eulerAngles = finalRotation; isRotate = false; //Stop audio FX rotated puzzle environment plane.GetComponent <PuzzleEnvironmentController>().PlayRotatedSoundFX(false); } else { CalDiffRotation(); currentRotation = Vector3.Slerp(currentRotation, finalRotation, 0.01f * rotatedSpeed); plane.transform.eulerAngles = currentRotation; } } if (Input.GetKeyDown(KeyCode.Z)) { topCamera.depth = topCamera.depth == 0 ? 1 : 0; } //*********************** Interaction with the trigger and submission ************************* if (isInQuestion && Input.GetKeyDown(KeyCode.E)) { if (isTriggerQuestion) { GameRoot.instance.IsLock(false); GameRoot.isPuzzleLock = false; P03W.ShowChoicePanel(false); isTriggerQuestion = false; GameRoot.instance.audioService.PlayUIAudio(Constants.audioP03ExitQuestion); } else { isTriggerQuestion = true; GameRoot.instance.IsLock(true); GameRoot.isPuzzleLock = true; P03W.ShowChoicePanel(true); GameRoot.instance.audioService.PlayUIAudio(Constants.audioP03TriggerQuestion); } } // *********************************************************************************************** if (isTipsAnimate) { tipsPoint2.localPosition = Vector3.Lerp(tipsPoint2.localPosition, tipsPoint2FinalPos, tipsAnimationSpeed); tipsPoint3.localPosition = Vector3.Lerp(tipsPoint3.localPosition, tipsPoint3FinalPos, tipsAnimationSpeed); Vector3 diffTP2 = tipsPoint2FinalPos - tipsPoint2.localPosition; Vector3 diffTP3 = tipsPoint3FinalPos - tipsPoint3.localPosition; if ((Mathf.Abs(diffTP2.x) <= 0.05f && Mathf.Abs(diffTP2.y) <= 0.05f && Mathf.Abs(diffTP2.z) <= 0.05f) && (Mathf.Abs(diffTP3.x) <= 0.05f && Mathf.Abs(diffTP3.y) <= 0.05f && Mathf.Abs(diffTP3.z) <= 0.05f)) { tipsPoint2.localPosition = tipsPoint2FinalPos; tipsPoint3.localPosition = tipsPoint3FinalPos; isTipsAnimate = false; } } //When player finish sub-level, the puzzle environment shift into next sub-level if (isShiftPlane) { playerPosition.position = Vector3.Lerp(playerPosition.position, playerPositionList[subPuzzleID].position, planeShiftSpeed); Vector3 diffPP = playerPositionList[subPuzzleID].position - playerPosition.position; if (Mathf.Abs(diffPP.z) <= 0.05f) { if (subPuzzleID >= DBP03.subLevelPlanes.Length) { playerPosition.position = playerPositionList[subPuzzleID].position; SetActive(endWall, false); P03W.ShowChoicePanel(false); GameRoot.instance.IsLock(false); GameRoot.ShowTips("", false, false); isInQuestion = false; P03W.SetInstructionalText("Go to the exit."); } isShiftPlane = false; } } previousPosition = player.transform.position; }
void Update() { if (Input.GetKeyDown(KeyCode.Z)) { if (!topCameraActive) { mainCamera.SetActive(false); topCamera.SetActive(true); topCameraActive = true; } else if (topCameraActive) { mainCamera.SetActive(true); topCamera.SetActive(false); topCameraActive = false; } } if (!MovementComplete) { if (Input.GetKeyDown(KeyCode.W)) { W.GetComponent <Text>().color = Color.green; wComplete = true; } if (Input.GetKeyDown(KeyCode.A)) { A.GetComponent <Text>().color = Color.green; aComplete = true; } if (Input.GetKeyDown(KeyCode.S)) { S.GetComponent <Text>().color = Color.green; sComplete = true; } if (Input.GetKeyDown(KeyCode.D)) { D.GetComponent <Text>().color = Color.green; dComplete = true; } if (dComplete && wComplete && aComplete && sComplete) { MovementTutorial.SetActive(false); TopViewTutorial.SetActive(true); MovementComplete = true; } } if (MovementComplete && !zComplete) { if (Input.GetKeyDown(KeyCode.Z) && zpressedonce == false) { Z.GetComponent <Text>().color = Color.green; zpressedonce = true; } else if (Input.GetKeyDown(KeyCode.Z) && zpressedonce) { Z2.GetComponent <Text>().color = Color.green; zpressedtwice = true; } if (zpressedonce && zpressedtwice) { TopViewTutorial.SetActive(false); FieldInput.SetActive(true); Questions.SetActive(true); zComplete = true; } } if (MovementComplete && zComplete && !rotateComplete) { if (inputedText == "5") { Debug.Log("Correct awnser inputted"); FieldInput.SetActive(false); Questions.SetActive(false); SelectionTutorial.SetActive(true); rotateComplete = true; } if (Input.GetKeyDown(KeyCode.P)) { Debug.Log(inputedText); } } if (player.transform.position.x - previousPosition.x < 0.01 && player.transform.position.y - previousPosition.y < 0.01 && player.transform.position.y - previousPosition.y < 0.01) { if (selectionComplete) { SelectionTutorial.SetActive(false); Congrats.SetActive(true); } } // player = GameObject.FindGameObjectWithTag("Player"); if (player.transform.position == previousPosition) { // Debug.Log("Not Moving"); timer += (int)Time.deltaTime + 1; if (timer == 1200) { // Debug.Log("Show Tip"); GameRoot.ShowTips("Press 'R' to reset position.", true, false); } } else { // Debug.Log("Moving"); timer = 0; } if (Input.GetKeyDown(KeyCode.R)) { player.transform.position = startPosition; //Debug.Log("R pressed"); GameRoot.ShowTips("", true, false); } previousPosition = player.transform.position; }
private void Update() { if (player.transform.position.x - previousPosition.x < 0.01 && player.transform.position.y - previousPosition.y < 0.01 && player.transform.position.y - previousPosition.y < 0.01) { timer += (int)Time.deltaTime + 1; if (timer == 1200) { GameRoot.ShowTips("Press 'R' to reset position.", true, false); } } else { timer = 0; } if (Input.GetKeyDown(KeyCode.R)) { player.transform.position = startPosition; GameRoot.ShowTips("", true, false); } //Update the instruction text based on the player status if (isInQues == true) { if (isTriggerQuestion) { SetText("- Press 'E': Exit the question.\n" + "- Press 'Z': Top-down camera."); } else { SetText("- Press 'E': Trigger the question."); } } else { SetText("Please stand on the question platform."); } //************************************************************ if (!DialogueManager.isInDialogue) { // Z key to switch camera if (Input.GetKeyDown(KeyCode.Z)) { SwitchCamera(); } if (isInQues && questionNum != 0) { // E key for the question tigger and exit if (!isTriggerQuestion && Input.GetKeyDown(KeyCode.E)) { //Show the dialogue when player trigger the question if (questionNum == 1 && DialogueManager.showP01_01) { FindObjectOfType <DialogueManager>().StartDialogue(resourceService.LoadConversation("Puzzle01_01")); DialogueManager.showP01_01 = false; } else if (questionNum == 2 && DialogueManager.showP01_03) { FindObjectOfType <DialogueManager>().StartDialogue(resourceService.LoadConversation("Puzzle01_03")); DialogueManager.showP01_03 = false; } else if (questionNum == 3 && DialogueManager.showP01_05) { FindObjectOfType <DialogueManager>().StartDialogue(resourceService.LoadConversation("Puzzle01_05")); DialogueManager.showP01_05 = false; } else if (questionNum == 4 && DialogueManager.showP01_07) { FindObjectOfType <DialogueManager>().StartDialogue(resourceService.LoadConversation("Puzzle01_07")); DialogueManager.showP01_07 = false; } //******************************************************** isTriggerQuestion = true; P01W.ShowInputPanel(true); P01W.ShowFeedbackPanel(true); GameRoot.instance.IsLock(true); //Resume cannot unlock the lock GameRoot.isPuzzleLock = true; //Dialogue manager cannot unlock the lock; DialogueManager.isPuzzleLock = true; //Set current question tips in feedback panel if (isFirstTimeTriggerQuestion) { P01W.SetFeedbackQuestionTips("Find the displacement\n" + DBP01.GetCurrentVector(questionNum) + " ->" + DBP01.GetCurrentVector(questionNum + 1)); isFirstTimeTriggerQuestion = false; } } else if (isTriggerQuestion && Input.GetKeyDown(KeyCode.E)) { isTriggerQuestion = false; P01W.ShowInputPanel(false); P01W.ShowFeedbackPanel(false); GameRoot.instance.IsLock(false); //Resume can unlock the lock GameRoot.isPuzzleLock = false; //Dialogue manager can unlock the lock; DialogueManager.isPuzzleLock = false; } } //Trigger Mast prop to end the puzzle01 if (isInMast && !isTriggerMast) { if (Input.GetKeyDown(KeyCode.E)) { isTriggerMast = true; congrats.Play(); endportal.gameObject.SetActive(true); //Congratulation FX audioService.PlayFXAudio(Constants.audioP01Congratulation); if (DialogueManager.showP01_09) { FindObjectOfType <DialogueManager>().StartDialogue(resourceService.LoadConversation("Puzzle01_09")); DialogueManager.showP01_09 = false; } } } } previousPosition = player.transform.position; }
void Update() { if (player.transform.position.x - previousPosition.x < 0.01 && player.transform.position.y - previousPosition.y < 0.01 && player.transform.position.y - previousPosition.y < 0.01) { timer += (int)Time.deltaTime + 1; if (timer == 1200) { GameRoot.ShowTips("Press 'R' to reset position, 'T' to dismiss", true, false); } } else { timer = 0; } if (Input.GetKeyDown(KeyCode.R)) { player.transform.position = startPosition; GameRoot.ShowTips("", true, false); } if (Input.GetKeyDown(KeyCode.T)) { GameRoot.ShowTips("", true, false); } if (ActiveBoat == 6) { GameRoot.ShowTips("You Completed the level!", true, false); GameRoot.instance.puzzleCompleted[1] = true; SetActive(endportal, true); } if (Input.GetKeyDown(KeyCode.Z)) { SwitchCamera(); topViewOn = !topViewOn; if (topViewOn) { TopViewText[ActiveBoat].gameObject.SetActive(true); TopViewText[6].gameObject.SetActive(true); normalText[ActiveBoat].gameObject.SetActive(false); } else { TopViewText[ActiveBoat].gameObject.SetActive(false); TopViewText[6].gameObject.SetActive(false); normalText[ActiveBoat].gameObject.SetActive(true); } Debug.Log("Z was pressed"); } if (isCannonTrigger && Input.GetKeyDown(KeyCode.E)) { cannonBarrel.SetActive(true); selectedVector = currentVector; isCannonSelected = true; Debug.Log("Selected Vector " + selectedVector[0] + ", " + selectedVector[1]); maincannonText.gameObject.GetComponent <TextMesh>().text = selectedVector[0] + "\n" + selectedVector[1]; Vector.text = selectedVector[0] + "\n" + selectedVector[1]; /* * //---------------------------------New Tips Function-------------------------------------- * if (isCannonSelected && isBallSelected) * GameRoot.ShowTips("The main gun is ready to fire", true, true); * else * GameRoot.ShowTips("Go pick the Cannon Ball or pick another Cannon", true, true); * //-------------------------------------------------------------------------------------------- */ audioService.PlayFXAudio(Constants.audioP02Selection); Debug.Log("Audio played"); } if (isCannonballTrigger && Input.GetKeyDown(KeyCode.E)) { selectedTransformMatrix = currentTransformMatrix; isBallSelected = true; Debug.Log("Selected Matrix " + selectedTransformMatrix[0] + ", " + selectedTransformMatrix[1] + ", " + selectedTransformMatrix[2] + ", " + selectedTransformMatrix[3]); Matrix.text = selectedTransformMatrix[0] + " " + selectedTransformMatrix[1] + "\n" + selectedTransformMatrix[2] + " " + selectedTransformMatrix[3]; /* * //---------------------------------New Tips Function-------------------------------------- * if (isCannonSelected && isBallSelected) * GameRoot.ShowTips("The main gun is ready to fire", true, true); * else * GameRoot.ShowTips("Go pick the Cannon or pick another Cannon Ball", true, true); * //-------------------------------------------------------------------------------------------- */ audioService.PlayFXAudio(Constants.audioP02Selection); Debug.Log("Audio played"); } if (isMainCannonTrigger && Input.GetKeyDown(KeyCode.E)) { if (selectedTransformMatrix != new int[] { 0, 0, 0, 0 } && selectedVector != new int[] { 0, 0 }) { FireCannon(); Debug.Log("cannon fired"); isBallSelected = false; isCannonSelected = false; } audioService.PlayFXAudio(Constants.audioP02CannonFire); } if (ballIsFlying) { tempCannonball.transform.position += targetPosition * Time.deltaTime; if (tempCannonball.transform.position.y <= -10) { ballIsFlying = false; } } previousPosition = player.transform.position; }
private void OnTriggerEnter(Collider other) { if (playerController == null) { playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); } if (other.tag == "Player") { playerController.isEnterExit = true; GameRoot.ShowTips("Press \"E\" to enter", true, false); switch (sceneName) { case SceneName.MenuScene: playerController.sceneName = Constants.menuSceneName; break; case SceneName.MainSceneName: playerController.sceneName = Constants.mainSceneName; if (SceneManager.GetActiveScene().name == Constants.puzzle01SceneName) { GameRoot.instance.exitPuzzle = 1; } else if (SceneManager.GetActiveScene().name == Constants.puzzle02SceneName) { GameRoot.instance.exitPuzzle = 2; } else if (SceneManager.GetActiveScene().name == Constants.puzzle03SceneName) { GameRoot.instance.exitPuzzle = 3; } break; case SceneName.Puzzle01SceneName: playerController.sceneName = Constants.puzzle01SceneName; break; case SceneName.Puzzle02SceneName: playerController.sceneName = Constants.puzzle02SceneName; break; case SceneName.Puzzle03SceneName: playerController.sceneName = Constants.puzzle03SceneName; break; case SceneName.CreditSceneName: playerController.sceneName = Constants.creditSceneName; break; } switch (puzzleComplete) { case PuzzleComplete.Puzzle01Complete: GameRoot.instance.puzzleCompleted[0] = true; break; case PuzzleComplete.Puzzle02Complete: GameRoot.instance.puzzleCompleted[1] = true; break; case PuzzleComplete.Puzzle03Complete: GameRoot.instance.puzzleCompleted[2] = true; break; default: break; } } }