}//eof /// <summary> /// This is the method that actually does the work. /// </summary> protected override void SolveInstance(IGH_DataAccess DA) { WiiObj wiiObj = new WiiObj(); Boolean led1 = false; Boolean led2 = false; Boolean led3 = false; Boolean led4 = false; Boolean rumble = false; if (!DA.GetData(0, ref wiiObj)) return; if (!DA.GetData(1, ref led1)) return; if (!DA.GetData(2, ref led2)) return; if (!DA.GetData(3, ref led3)) return; if (!DA.GetData(4, ref led4)) return; if (!DA.GetData(5, ref rumble)) return; wiiObj.wiimote.SetLEDs(led1, led2, led3, led4); wiiObj.wiimote.SetRumble(rumble); }//eof
}//eof /// <summary> /// This is the method that actually does the work. /// </summary> protected override void SolveInstance(IGH_DataAccess DA) { WiiObj wiiObj = new WiiObj(); if(!DA.GetData(0, ref wiiObj)) return; List<object> irsernsorP2 = new List<object>(); List<bool> buttons = new List<bool>(); for (int i = 0; i < wiiObj.state.IRState.IRSensors.Length; ++i) { if (wiiObj.state.IRState.IRSensors[i].Found) { float x = wiiObj.state.IRState.IRSensors[i].RawPosition.X; float y = wiiObj.state.IRState.IRSensors[i].RawPosition.Y; irsernsorP2.Add(new Point2d(x,y)); } else { irsernsorP2.Add(null); } } Vector3d accelVt = new Vector3d(wiiObj.state.AccelState.Values.X, wiiObj.state.AccelState.Values.Y, wiiObj.state.AccelState.Values.Z); buttons.Add(wiiObj.state.ButtonState.A); buttons.Add(wiiObj.state.ButtonState.B); buttons.Add(wiiObj.state.ButtonState.Minus); buttons.Add(wiiObj.state.ButtonState.Home); buttons.Add(wiiObj.state.ButtonState.Plus); buttons.Add(wiiObj.state.ButtonState.One); buttons.Add(wiiObj.state.ButtonState.Two); buttons.Add(wiiObj.state.ButtonState.Up); buttons.Add(wiiObj.state.ButtonState.Down); buttons.Add(wiiObj.state.ButtonState.Left); buttons.Add(wiiObj.state.ButtonState.Right); DA.SetDataList(0, irsernsorP2); DA.SetData(1, accelVt); DA.SetDataList(2, buttons); }//eof