示例#1
0
        void DischargeObserve()
        {
            var controllerVelocityObserver = pose
                                             .ObserveEveryValueChanged(p => p.GetVelocity(hand).sqrMagnitude);

            controllerVelocityObserver
            .Where(x => x > 35f)
            .Subscribe(_ => isHandMoving = true);

            controllerVelocityObserver
            .Where(_ => isHandMoving)
            .Where(x => x < 1.0f)
            .Subscribe(_ => stopJudgeCounter.Value++);

            stopJudgeCounter.Where(x => x == 10)
            .Subscribe(_ =>
            {
                _onDischarge.OnNext(Unit.Default);
                stopJudgeCounter.Value = 0;
                isHandMoving           = false;
            });
        }