void UpdateRecord() { // get input if (input == null) { input = rig.GetInput(hand); } // if not pressing gesture button stop recording if (!input.GetButton(rig.gestureButton)) { state = VRGestureCaptureState.ReadyToCapture; if (input.GetButtonUp(rig.gestureButton)) { StopRecording(); } } // if pressed button start recording if (input.GetButtonDown(rig.gestureButton) && state == VRGestureCaptureState.ReadyToCapture) { state = VRGestureCaptureState.Capturing; StartRecording(); } // if capturing, capture points if (state == VRGestureCaptureState.Capturing) { CapturePoint(); } }
public override bool ButtonUp() { if (input != null) { bool buttonUp = input.GetButtonUp(selectButton); return(buttonUp); } return(false); }
void UpdateRecord() { if (input.GetButtonUp(gestureButton)) { state = VRGestureManagerState.ReadyToRecord; StopRecording(); } if (input.GetButtonDown(gestureButton) && state == VRGestureManagerState.ReadyToRecord) { state = VRGestureManagerState.Recording; StartRecording(); } if (state == VRGestureManagerState.Recording) { CapturePoint(); } }
/// <summary> /// This is checking the button up for an INDEX. left or right. 0 or 1? /// /// </summary> /// <param name="index"></param> /// <returns></returns> public bool ButtonUp(int index) { if (index == 0) { bool pressed = false; if (ControllerInputLeft != null) { pressed = ControllerInputLeft.GetButtonUp(InputOptions.Button.Trigger1); } return(pressed); } else { bool pressed = false; if (ControllerInputRight != null) { pressed = ControllerInputRight.GetButtonUp(InputOptions.Button.Trigger1); } return(pressed); } }
void Update() { switch (state) { case State.Inactive: { if (hero.CanMove && input.GetButtonDown(ButtonCode.Jet)) { state = State.Ready; EffectOnReady(); } } break; case State.Ready: { if (!hero.CanMove) { state = State.Inactive; break; } chargeSeconds += hero.TimeManager.DeltaTimeAroundHero; if (input.GetButtonUp(ButtonCode.Jet)) { state = State.Jetting; JetParams params_ = hero.Parameters.JetParams; float charge_0_1 = Mathf.Clamp01( Mathf.InverseLerp ( params_.ChargeSecondsFromMin * params_.TimeScaleBeforeJet, params_.ChargeSecondsToMax * params_.TimeScaleBeforeJet, chargeSeconds ) ); hero.Jet(charge_0_1) .Subscribe(_ => { coolTimeLeft = hero.Parameters.JetParams.CoolTime; state = State.CoolTime; EffectOnExit(); _JetEnded.OnNext(Unit.Default); }); EffectOnJet(); chargeSeconds = 0; } } break; case State.Jetting: { // } break; case State.CoolTime: { coolTimeLeft -= hero.TimeManager.DeltaTimeAroundHero; if (coolTimeLeft <= 0) { state = State.Inactive; } } break; } }