// Update is called once per frame void Update() { #if (UNITY_EDITOR) // Modify Time Scale if (GamepadManager.GetControllerKeyReleased(playersWithAccess[0], GamepadManager.ButtonCode.Y)) { Time.timeScale++; } else if (GamepadManager.GetControllerKeyReleased(playersWithAccess[0], GamepadManager.ButtonCode.X)) { Time.timeScale--; } // Other stuff if (GamepadManager.GetControllerKeyReleased(playersWithAccess[0], GamepadManager.ButtonCode.Shldr_LEFT)) { LevelController.respawnTiles = !LevelController.respawnTiles; } if (GamepadManager.GetControllerKeyReleased(playersWithAccess[0], GamepadManager.ButtonCode.Shldr_RIGHT)) { LevelController.timedFall = !LevelController.timedFall; } currentButtonName = currentButton.gameObject.name; #endif if (!currentButton.GetComponent <Button>().interactable&& !lockToStartButton) { try { currentButton = currentButton.GetComponent <ButtonLinker>().getRight(); } catch { try { currentButton = currentButton.GetComponent <ButtonLinker>().getDown(); } catch { Debug.Log("Controller cursor locked on inactive button!"); } }; } for (int k = 0; k < playersWithAccess.Length; k++) { // Press A if (GamepadManager.GetControllerKeyReleased(playersWithAccess[k], GamepadManager.ButtonCode.A) || keyboardNavigation(Jump)) { ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerClickHandler); if (currentButton.GetComponent <ButtonLinker>().transitionButton) { ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerExitHandler); currentButton = currentButton.GetComponent <ButtonLinker>().target; ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerEnterHandler); } currentThumbstickTime = thumbstickTime; } // Press B if (GamepadManager.GetControllerKeyReleased(playersWithAccess[k], GamepadManager.ButtonCode.B) || Input.GetKeyDown(KeyCode.Escape)) { if (currentButton.GetComponent <ButtonLinker>().backButton != null) { ExecuteEvents.Execute(currentButton.GetComponent <ButtonLinker>().backButton, buttonInteract, ExecuteEvents.pointerClickHandler); ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerExitHandler); currentButton = currentButton.GetComponent <ButtonLinker>().backButton.GetComponent <ButtonLinker>().target; ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerEnterHandler); } currentThumbstickTime = thumbstickTime; } if (currentThumbstickTime <= 0f) { // Press UP if (controllerMenuNavigation(playersWithAccess[k], Up) || keyboardNavigation(Up)) { ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerExitHandler); try { currentButton = currentButton.GetComponent <ButtonLinker>().getUp(); } catch { Debug.Log("UP Direction is NULL"); }; cursor.transform.position = currentButton.transform.position; currentThumbstickTime = thumbstickTime; ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerEnterHandler); } // Press Down else if (controllerMenuNavigation(playersWithAccess[k], Down) || keyboardNavigation(Down)) { ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerExitHandler); try { currentButton = currentButton.GetComponent <ButtonLinker>().getDown(); } catch { Debug.Log("DOWN Direction is NULL"); }; cursor.transform.position = currentButton.transform.position; currentThumbstickTime = thumbstickTime; ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerEnterHandler); } // Press Left else if (controllerMenuNavigation(playersWithAccess[k], Left) || keyboardNavigation(Left)) { ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerExitHandler); try { currentButton = currentButton.GetComponent <ButtonLinker>().getLeft(); } catch { Debug.Log("LEFT Direction is NULL"); }; cursor.transform.position = currentButton.transform.position; currentThumbstickTime = thumbstickTime; ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerEnterHandler); } // Press Right else if (controllerMenuNavigation(playersWithAccess[k], Right) || keyboardNavigation(Right)) { ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerExitHandler); try { currentButton = currentButton.GetComponent <ButtonLinker>().getRight(); } catch { Debug.Log("RIGHT Direction is NULL"); }; cursor.transform.position = currentButton.transform.position; currentThumbstickTime = thumbstickTime; ExecuteEvents.Execute(currentButton, buttonInteract, ExecuteEvents.pointerEnterHandler); } } } currentThumbstickTime -= Time.fixedDeltaTime; //Time.deltaTime; }