void PrepareForUpdate(ulong updateTick) { if (this == InputControl.Null) { return; } if (updateTick < pendingTick) { throw new InvalidOperationException("Cannot be updated with an earlier tick."); } if (pendingCommit && updateTick != pendingTick) { throw new InvalidOperationException("Cannot be updated for a new tick until pending tick is committed."); } if (updateTick > pendingTick) { lastState = thisState; nextState.Reset(); pendingTick = updateTick; pendingCommit = true; } }
public void Commit() { thisState = tempState; WasRepeated = false; if (WasReleased) { nextRepeatTime = 0.0f; } else if (IsPressed) { if (HasChanged) { nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay; } else if (Time.realtimeSinceStartup >= nextRepeatTime) { WasRepeated = true; nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay; } } if (thisState != lastState) { UpdateTick = pendingTick; } pendingCommit = false; }
internal void PreUpdate(ulong updateTick) { RawValue = null; PreValue = null; lastState = thisState; tempState.Reset(); }
internal void PostUpdate(ulong updateTick) { thisState = tempState; if (thisState != lastState) { UpdateTick = updateTick; } }
internal void PreUpdate( ulong updateTick ) { RawValue = null; PreValue = null; lastState = thisState; tempState.Reset(); }
public void Commit() { if (IsNull) { return; } pendingCommit = false; // nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold ); thisState = nextState; if (clearInputState) { // The net result here should be that the entire state will return zero/false // from when ResetState() is called until the next call to Commit(), which is // the next update tick, and WasPressed, WasReleased and WasRepeated will then // return false during this following tick. lastState = nextState; UpdateTick = pendingTick; clearInputState = false; return; } var lastPressed = lastState.State; var thisPressed = thisState.State; wasRepeated = false; if (lastPressed && !thisPressed) // if was released... { nextRepeatTime = 0.0f; } else if (thisPressed) // if is pressed... { if (lastPressed != thisPressed) // if has changed... { nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay; } else if (Time.realtimeSinceStartup >= nextRepeatTime) { wasRepeated = true; nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay; } } if (thisState != lastState) { UpdateTick = pendingTick; } //ÉèÖûص÷ SetCallback(); }
internal void SetValue(float value, ulong updateTick) { if (updateTick > pendingTick) { lastState = thisState; nextState.Reset(); pendingTick = updateTick; pendingCommit = true; } nextState.RawValue = value; nextState.Set(value, StateThreshold); }
public void UpdateWithValue(float value, float updateTime) { if (IsNull) { throw new InvalidOperationException("A null control cannot be updated."); } lastState = thisState; if (thisState != value) { UpdateTime = updateTime; thisState.Set(value); } }
public void UpdateWithValue( float value, ulong updateTick, float stateThreshold ) { if (UpdateTick > updateTick) { throw new InvalidOperationException( "A control cannot be updated with an earlier tick." ); } lastState = thisState; thisState.Set( value, stateThreshold ); if (thisState != lastState) { UpdateTick = updateTick; } }
public void UpdateWithValue(float value, ulong updateTick, float stateThreshold) { if (UpdateTick > updateTick) { throw new InvalidOperationException("A control cannot be updated with an earlier tick."); } lastState = thisState; thisState.Set(value, stateThreshold); if (thisState != lastState) { UpdateTick = updateTick; } }
void PrepareForUpdate( ulong updateTick ) { if (updateTick < pendingTick) { throw new InvalidOperationException( "Cannot be updated with an earlier tick." ); } if (pendingCommit && updateTick != pendingTick) { throw new InvalidOperationException( "Cannot be updated for a new tick until pending tick is committed." ); } if (updateTick > pendingTick) { lastState = thisState; tempState.Reset(); pendingTick = updateTick; pendingCommit = true; } }
public void Commit() { if (IsNull) { return; } pendingCommit = false; thisState = nextState; if (clearInputState) { lastState = nextState; UpdateTick = pendingTick; clearInputState = false; return; } bool state = lastState.State; bool state2 = thisState.State; wasRepeated = false; if (state && !state2) { nextRepeatTime = 0f; } else if (state2) { if (state != state2) { nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay; } else if (Time.realtimeSinceStartup >= nextRepeatTime) { wasRepeated = true; nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay; } } if (thisState != lastState) { UpdateTick = pendingTick; } }
public void Commit() { // nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold ); thisState = nextState; var lastPressed = lastState.State; var thisPressed = thisState.State; wasRepeated = false; if (lastPressed && !thisPressed) // if was released... { nextRepeatTime = 0.0f; } else if (thisPressed) // if is pressed... { if (lastPressed != thisPressed) // if has changed... { nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay; } else if (Time.realtimeSinceStartup >= nextRepeatTime) { wasRepeated = true; nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay; } } if (thisState != lastState) { UpdateTick = pendingTick; } pendingCommit = false; }
public void Commit() { thisState = tempState; var lastPressed = lastState.State; var thisPressed = thisState.State; wasRepeated = false; if (lastPressed && !thisPressed) // if (WasReleased) { nextRepeatTime = 0.0f; } else if (thisPressed) // if (IsPressed) { if (lastPressed != thisPressed) // if (HasChanged) { nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay; } else if (Time.realtimeSinceStartup >= nextRepeatTime) { wasRepeated = true; nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay; } } if (thisState != lastState) { UpdateTick = pendingTick; } pendingCommit = false; }
internal void PreUpdate(ulong updateTick) { lastState = thisState; tempState.Reset(); }
internal void SetValue( float value, ulong updateTick ) { if (updateTick > pendingTick) { lastState = thisState; nextState.Reset(); pendingTick = updateTick; pendingCommit = true; } nextState.RawValue = value; nextState.Set( value, StateThreshold ); }
public void Commit() { pendingCommit = false; // nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold ); thisState = nextState; if (clearInputState) { // The net result here should be that the entire state will return zero/false // from when ResetState() is called until the next call to Commit(), which is // the next update tick, and WasPressed, WasReleased and WasRepeated will then // return false during this following tick. lastState = nextState; UpdateTick = pendingTick; clearInputState = false; return; } var lastPressed = lastState.State; var thisPressed = thisState.State; wasRepeated = false; if (lastPressed && !thisPressed) // if was released... { nextRepeatTime = 0.0f; } else if (thisPressed) // if is pressed... { if (lastPressed != thisPressed) // if has changed... { nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay; } else if (Time.realtimeSinceStartup >= nextRepeatTime) { wasRepeated = true; nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay; } } if (thisState != lastState) { UpdateTick = pendingTick; } }
internal void PreUpdate( ulong updateTick ) { lastState = thisState; tempState.Reset(); }
internal void PostUpdate( ulong updateTick ) { thisState = tempState; if (thisState != lastState) { UpdateTick = updateTick; } }
public void UpdateWithValue( float value, float updateTime ) { if (IsNull) { throw new InvalidOperationException( "A null control cannot be updated." ); } lastState = thisState; if (thisState != value) { UpdateTime = updateTime; thisState.Set( value ); } }