IEnumerator FinishTutorial() { //fade out here. yield return(new WaitForSeconds(1f)); overallManager.skipScene(); }
// Update is called once per frame void Update() { if (!canControl) { return; } else { counterDirection = false; } // Set Controller Mapping, get situation at current frame. controllerLeftMapping = (Input.GetKeyDown(KeyCode.A) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickLeft) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickLeft)); controllerUpMapping = (Input.GetKeyDown(KeyCode.W) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickUp) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickUp)); controllerRightMapping = (Input.GetKeyDown(KeyCode.D) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickRight) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickRight)); controllerDownMapping = (Input.GetKeyDown(KeyCode.S) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickDown) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickDown)); controllerABMapping = ((Input.GetKeyDown(KeyCode.Space) || OVRInput.GetDown(OVRInput.Button.One) || OVRInput.GetDown(OVRInput.Button.Two))); controllerTriggerMapping = (Input.GetKeyDown(KeyCode.Backspace) || OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) || OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger)); // Open menu with trigger after you chose something in this turn. /* * if (!menuOpen && controllerCancelMapping) * { * SetMenuActive(true); * } */ //Debug.Log(controlMode); switch (controlMode) { // Control Mode: Move // below is all the character movement code. case 0: if (!menuOpen) { SetMenuActive(true); rightHandHoverUI.GetComponentInChildren <UnityEngine.UI.Text>().text = ""; } // Highlighting options if (CurrentHighlightButton == null) { MoveButton.Select(); CurrentHighlightButton = MoveButton; } else { // press left and find left if (controllerLeftMapping) { Selectable newButton = CurrentHighlightButton.FindSelectableOnLeft(); if (newButton != null) { newButton.Select(); CurrentHighlightButton = newButton; AudioCenter.PlaySelectionAlt(); } else { AudioCenter.PlayCantDoThat(); } } if (controllerRightMapping) { Selectable newButton = CurrentHighlightButton.FindSelectableOnRight(); if (newButton != null) { newButton.Select(); CurrentHighlightButton = newButton; AudioCenter.PlaySelectionAlt(); } else { AudioCenter.PlayCantDoThat(); } } if (controllerDownMapping) // choose exit { currentHighlight = (int)Status.Exit; CurrentHighlightButton = SkipButton; SkipButton.Select(); AudioCenter.PlaySelectionAlt(); } if (controllerUpMapping) // choose move { MoveButton.Select(); CurrentHighlightButton = MoveButton; AudioCenter.PlaySelectionAlt(); } } // After Highlighting -- Make choices // 1) Set Mode to Move if (CurrentHighlightButton == MoveButton) { if (!moveDisabled && controllerTriggerMapping) { ChangeControlMode(); controlMode = 1; AudioCenter.PlaySelectionConfirm(); rightHandHoverUI.GetComponentInChildren <UnityEngine.UI.Text>().text = "Move Mode"; if (moveDisabled && controllerTriggerMapping) { rightHandHoverUI.GetComponentInChildren <UnityEngine.UI.Text>().text = "Can't do that now"; AudioCenter.PlayCantDoThat(); } } } // 2) Set Mode to Send if (CurrentHighlightButton == SendButton) { if (sendItemDisabled && controllerTriggerMapping) { rightHandHoverUI.GetComponentInChildren <UnityEngine.UI.Text>().text = "Can't do that now"; AudioCenter.PlayCantDoThat(); } if (!sendItemDisabled && controllerTriggerMapping) { ChangeControlMode(); controlMode = 2; AudioCenter.PlaySelectionConfirm(); rightHandHoverUI.GetComponentInChildren <UnityEngine.UI.Text>().text = "Send Mode"; } } // 3) Set Mode to Item if (CurrentHighlightButton == ItemButton) { if (controllerTriggerMapping) { rightHandHoverUI.GetComponentInChildren <UnityEngine.UI.Text>().text = "Can't do that now"; AudioCenter.PlayCantDoThat(); } } // 4) Exit and return to previous mode if (CurrentHighlightButton == SkipButton) { if (controllerTriggerMapping) { AudioCenter.PlaySelectionConfirm(); tutorialStateManager.skipScene(); } } break; case 1: if (!BeginMove) { LaserPointer.GetComponent <RaserPointer>().Show = true; /* * if ((Input.GetKeyDown(KeyCode.W) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickUp) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickUp)) || ) || { || || PlayerModel.transform.LookAt(PlayerOnBoard.transform.position + new Vector3(0.2f, 0, 0)); || detectBall.transform.position = PlayerOnBoard.transform.position + new Vector3(0.2f, 0, 0); || } || || if ((Input.GetKeyDown(KeyCode.S) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickDown) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickDown)) || ) || { || // Debug.Log("w"); || PlayerModel.transform.LookAt(PlayerOnBoard.transform.position + new Vector3(-0.2f, 0, 0)); || detectBall.transform.position = PlayerOnBoard.transform.position + new Vector3(-0.2f, 0, 0); || } || || if ((Input.GetKeyDown(KeyCode.A) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickLeft) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickLeft)) || ) || { || PlayerModel.transform.LookAt(PlayerOnBoard.transform.position + new Vector3(0, 0, 0.2f)); || detectBall.transform.position = PlayerOnBoard.transform.position + new Vector3(0, 0, 0.2f); || } || || if ((Input.GetKeyDown(KeyCode.D) || OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickRight) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickRight)) || ) || { || // Debug.Log("w"); || PlayerModel.transform.LookAt(PlayerOnBoard.transform.position + new Vector3(0, 0, -0.2f)); || detectBall.transform.position = PlayerOnBoard.transform.position + new Vector3(0, 0, -0.2f); || } */ if (Input.GetKeyDown(KeyCode.G) || OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) || OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger)) { if (LaserPointer.GetComponent <RaserPointer>().tile.GetComponent <TileHealthyManager>().couldMoveTo) { BeginMove = true; target = LaserPointer.GetComponent <RaserPointer>().tile.transform.position; target.y = PlayerOnBoard.transform.position.y; PlayerModel.transform.LookAt(target); hideCursor(); } } } if (BeginMove) { float step = 0.1f * Time.deltaTime; PlayerOnBoard.transform.position = Vector3.MoveTowards(PlayerOnBoard.transform.position, target, step); if (PlayerOnBoard.transform.position == target) { BeginMove = false; } } break; // Control mode: Send case 2: break; // Control mode: Use Item case 3: break; case 4: if (menuOpen) { LaserPointer.GetComponent <RaserPointer>().Show = false; SetMenuActive(false); } if (!menuOpen && controllerABMapping) { LaserPointer.GetComponent <RaserPointer>().Show = false; controlMode = 0; AudioCenter.PlaySelectionConfirm(); } break; } }