private void BroadcastRotationStateChange(bool right, RotationState current, RotationState previous) { if (current == previous) { return; } if (right) { RightRotationStateChanged?.Invoke(current, previous); } else { LeftRotationStateChanged?.Invoke(current, previous); } }
void UpdateRotationState(bool right) { RotationState previousRotationState = (right) ? currentRightRotationState : currentLeftRotationState; if (right) { if (Vector3.Dot(Vector3.up, RightMarker.Instance.transform.up) >= 0.75f) { currentRightRotationState = RotationState.lowerCase; } if (Vector3.Dot(Vector3.up, RightMarker.Instance.transform.right) >= 0.75f) { currentRightRotationState = RotationState.upperCase; } if (Vector3.Dot(Vector3.up, -1 * RightMarker.Instance.transform.right) >= 0.75f) { currentRightRotationState = RotationState.specialCharacters; } if ((rightHandState & TouchStates.middle) != 0 && Vector3.Dot( RightMarker.Instance.transform.right, _selectionRightStartingMarker.transform.forward ) > 0.75 ) { currentRightRotationState = RotationState.numbers; } RightRotationStateChanged?.Invoke(currentRightRotationState, previousRotationState); } else { //ADM.QLog(string.Format("Input Left Rotation Results - " + // "lowercase condition: {0} " + // "uppercase condition: {1} " + // "special char condition: {2} " + // "numbers condition: {3}", // Vector3.Dot(Vector3.up, LeftMarker.Instance.transform.up), // Vector3.Dot(Vector3.up, -1 * LeftMarker.Instance.transform.right), // Vector3.Dot(Vector3.up, LeftMarker.Instance.transform.right), // Vector3.Dot(-1 * LeftMarker.Instance.transform.right, _selectionLeftStartingMarker.transform.forward) // )); if (Vector3.Dot(Vector3.up, LeftMarker.Instance.transform.up) >= 0.75f) { currentLeftRotationState = RotationState.lowerCase; } if (Vector3.Dot(Vector3.up, -1 * LeftMarker.Instance.transform.right) >= 0.75f) { currentLeftRotationState = RotationState.upperCase; } if (Vector3.Dot(Vector3.up, LeftMarker.Instance.transform.right) >= 0.75f) { currentLeftRotationState = RotationState.specialCharacters; } if ((leftHandState & TouchStates.middle) != 0 && Vector3.Dot(-1 * LeftMarker.Instance.transform.right, _selectionLeftStartingMarker.transform.forward) > 0.75f) { currentLeftRotationState = RotationState.numbers; } ADM.QLog("Left new rotation state: " + currentLeftRotationState); LeftRotationStateChanged?.Invoke(currentLeftRotationState, previousRotationState); } }