public void Update() { // Saving previous state PreviousState.Copy(CurrentState); // Getting raw gamepad state uint result = XInputInterface.XInputGamePadGetState(playerIndex, out rawState); // Zeroing raw state if the controller is not connected if (result != XInputInterface.RESULT_SUCCESS) { rawState.dwPacketNumber = 0; rawState.Gamepad.wButtons = 0; rawState.Gamepad.bLeftTrigger = 0; rawState.Gamepad.bRightTrigger = 0; rawState.Gamepad.sThumbLX = 0; rawState.Gamepad.sThumbLY = 0; rawState.Gamepad.sThumbRX = 0; rawState.Gamepad.sThumbRY = 0; } // Updating cycle related flags IsConnected = result == XInputInterface.RESULT_SUCCESS; HasChanges = PacketNumber != rawState.dwPacketNumber; // Quitting early if we have no changes if (!HasChanges) { return; } // Updating current state PacketNumber = rawState.dwPacketNumber; CurrentState.Apply(rawState); }
protected virtual void OnActionCompleted(IDomainAction action) { _logger.Trace("Execution of action `{0}` was successful.", action.ActionName); CurrentState = CurrentState.Apply(action.Effects); }