public IState <SynchroGazerStatus> Update(SynchroGazerStatus source) { if (!source.IsUserPresent) { source.RaiseBlinkAction(BlinkActionTypes.None); return(new NotPresentState()); } if (ShouldGoToDefaultState(source)) { source.RaiseBlinkAction(BlinkActionTypes.None); return(new DefaultState()); } bool blinkCheckNeeded = UpdateBlinkCount(source); if (blinkCheckNeeded && StateMachineUtils.GetWinkCount(_blinks) >= GetCommandBlinkCount(source)) { //NOTE: BlinkActionより先にFixを解除することが絶対に必要。 //理由: マウスが視点アイコンと干渉するのを防ぐ為。 source.FixDisplayPosition = false; source.RaiseBlinkAction(BlinkActionType); return(new CommandEndState()); } return(this); }
public IState <SynchroGazerStatus> Update(SynchroGazerStatus source) { if (!source.IsUserPresent) { return(new NotPresentState()); } UpdateWinkTime(source); bool blinkCountUpdated = UpdateBlinkCount(source); _lastTimestamp = source.TimeStamp; if (_leftWinkCountMillisec > WinkThreashold) { return(new LeftWinkState()); } else if (_rightWinkCountMillisec > WinkThreashold) { return(new RightWinkState()); } else if ( blinkCountUpdated && StateMachineUtils.GetWinkCount(_leftBlinks) >= CommandBlinkCount && StateMachineUtils.GetWinkCount(_rightBlinks) >= CommandBlinkCount ) { _leftBlinks.Clear(); _rightBlinks.Clear(); source.RaiseBlinkAction(BlinkActionTypes.Blink); } return(this); }