// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.D)) { if (manager.GetIsDuringTransition()) { if (manager.GetCurrentTransitionType() == TransitionType.Forward) { manager.SkipTransition(); } } else { manager.VisitNextScene(); } } if (Input.GetKeyDown(KeyCode.A)) { if (manager.GetIsDuringTransition()) { if (manager.GetCurrentTransitionType() == TransitionType.Backward) { manager.SkipTransition(); } } else { manager.VisitPreviousScene(); } } }
void SelectButtonBasedOnThumbstickCoordinates(Vector2 thumbStickCoordinates) { float angle = Vector2.SignedAngle(Vector2.right, thumbStickCoordinates); if (-45 <= angle && angle <= 45) { // Debug.Log(currentSelectedButtonMode); /// the != NextScene check is to prevent the following code (73~84) from being called too many times; the != SkipNextScene check is to prevent the back and forth buttonMode change (rmb what /// the coroutine does) when holding the thumbstick; the !gtm check is to make sure the following code doesn't get called during transition; if (!guidedTourManager.GetIsDuringTransition() && rightButton.GetComponent <RadialMenuButton>().CurrentState != ButtonState.Disabled && currentSelectedButtonType != ButtonType.Right && currentSelectedButtonType != ButtonType.RightOuter) { // Debug.Log("This should only get called from none to right"); // Debug.Log("Does this still get called during transition? Cuz if so, hmm??"); if (isUpgradeButtonCoroutineRunning) { StopCoroutine(upgradeButtonCoroutine); isUpgradeButtonCoroutineRunning = false; } DeselectButton(); SelectButton(rightButton); currentSelectedButtonType = ButtonType.Right; // Debug.Log("is SelectButtonStates being called"); upgradeButtonCoroutine = StartCoroutine(UpgradeCurrentSelectedButton()); } /// this is for skipping in the middle of a transition else if (guidedTourManager.GetIsDuringTransition() && rightOuterButton.GetComponent <RadialMenuButton>().CurrentState != ButtonState.Disabled && currentSelectedButtonType != ButtonType.RightOuter) { // Debug.Log("is this being called when during transition?"); DeselectButton(); SelectButton(rightOuterButton); currentSelectedButtonType = ButtonType.RightOuter; } } else if (45 <= angle && angle <= 125 && topButton.GetComponent <RadialMenuButton>().CurrentState != ButtonState.Disabled) { if (currentSelectedButtonType != ButtonType.Top) { DeselectButton(); SelectButton(topButton); currentSelectedButtonType = ButtonType.Top; } } else if (angle >= 125 || angle <= -125) { if (!guidedTourManager.GetIsDuringTransition() && leftButton.GetComponent <RadialMenuButton>().CurrentState != ButtonState.Disabled && currentSelectedButtonType != ButtonType.Left && currentSelectedButtonType != ButtonType.LeftOuter) { if (isUpgradeButtonCoroutineRunning) { StopCoroutine(upgradeButtonCoroutine); isUpgradeButtonCoroutineRunning = false; } DeselectButton(); SelectButton(leftButton); currentSelectedButtonType = ButtonType.Left; upgradeButtonCoroutine = StartCoroutine(UpgradeCurrentSelectedButton()); } else if (guidedTourManager.GetIsDuringTransition() && leftOuterButton.GetComponent <RadialMenuButton>().CurrentState != ButtonState.Disabled && currentSelectedButtonType != ButtonType.LeftOuter) { DeselectButton(); SelectButton(leftOuterButton); currentSelectedButtonType = ButtonType.LeftOuter; } } else if (-125 <= angle && angle <= -45 && downButton.GetComponent <RadialMenuButton>().CurrentState != ButtonState.Disabled) { if (currentSelectedButtonType != ButtonType.Down) { DeselectButton(); SelectButton(downButton); currentSelectedButtonType = ButtonType.Down; } } else { DeselectButton(); currentSelectedButtonType = ButtonType.None; } }