public void Update() { if (!bDoOnce) { CS_WiiMoteManager.FindWiimotes(); bDoOnce = true; } if (!CS_WiiMoteManager.HasWiimote()) { return; } if (bStartRumble) { Rumble(); } wiimote = CS_WiiMoteManager.Wiimotes[0]; wiimote.SetupIRCamera(IRDataType.BASIC); float fStick1 = data.stick[1]; float fStick2 = data.stick[0]; //Tests if there is a wiimote and is has an extension if (wiimote != null && wiimote.current_ext != ExtensionController.NONE && !bDoOnce1) { data = wiimote.Nunchuck; bDoOnce1 = true; } xRot = (fStick1 - fXMid) / (0.5f * fRange); yRot = (fStick2 - fYMid) / (0.5f * fRange); //order to make sure it doesn't fall behind the Wiimote's update frequency do { iData = wiimote.ReadWiimoteData(); } while (iData > 0); }
public void Init() { data = new CS_NunchuckData(wiimote); bDoOnce = false; bDoOnce1 = false; bOnce = true; fTimer = 0; bStartRumble = false; }