protected override void OnDisabled(DisabledEventArgs e) { if (!e.IsConfiguring) { PhidgetManager.Release <InterfaceKit>(ref ifKit); } }
public override void OnLoad() { ifKit = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); ifKit.Attach += ifKit_Attach; ifKit.Detach += ifKit_Detach; PopulateOutputs(); CheckCanSave(); OutputBox.SelectedIndex = Index; ControlBox.SelectedIndex = 0; switch (OutputType) { case DigitalOutputType.Toggle: ControlBox.SelectedIndex = 0; break; case DigitalOutputType.On: ControlBox.SelectedIndex = 1; break; case DigitalOutputType.Off: ControlBox.SelectedIndex = 2; break; } }
public override void OnLoad() { servo = PhidgetManager.Get <AdvancedServo>(false); servo.Attach += servo_Attach; servo.Detach += servo_Detach; foreach (string servoType in Enum.GetNames(typeof(ServoServo.ServoType))) { //stop here if (servoType.Equals(ServoServo.ServoType.USER_DEFINED.ToString())) { break; } TypeComboBox.Items.Add(servoType); // Select the type we are given originally. if (servoType == ServoType.ToString()) { TypeComboBox.SelectedItem = servoType; } } PositionSlider.Value = Position; // Set the text (this doesn't get called if position was 0) PositionSlider_ValueChanged(null, null); SetAttached(); }
public override void OnClosing() { sensor.Attach -= sensor_Attach; sensor.Detach -= sensor_Detach; sensor.TemperatureChange -= sensor_TemperatureChange; PhidgetManager.Release(ref sensor); }
public override void OnClosing() { servo.Attach -= servo_Attach; servo.Detach -= servo_Detach; PhidgetManager.Release <AdvancedServo>(ref servo); }
public override void OnClosing() { Ir.Code -= ir_Code; Ir.Attach -= ir_Attach; Ir.Detach -= ir_Detach; PhidgetManager.Release(ref Ir); }
public void TestOneKitIsOneCount() { var k1 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); Assert.AreEqual(1, PhidgetManager.GetReferenceCount <InterfaceKit>()); PhidgetManager.Release <InterfaceKit>(ref k1); }
protected override void OnDisabled(DisabledEventArgs e) { // only release if we aren't going into the configuration menu if (!e.IsConfiguring) { PhidgetManager.Release(ref advServo); } }
public override void OnClosing() { Sensor.OnRevalidate -= Revalidate; IfKit.Attach -= ifKit_Attach; IfKit.Detach -= IfKit_Detach; PhidgetManager.Release(ref IfKit); }
private void Update() { GameObject Ch11_nonPBR = GameObject.Find("Ch11_nonPBR"); PhidgetManager phidgetManager = Ch11_nonPBR.GetComponent <PhidgetManager>(); CombinedWeight = (Mathf.Abs(phidgetManager.horizontalWeight) + Mathf.Abs(phidgetManager.verticalWeight)) / 2; if (Mathf.Abs(phidgetManager.horizontalWeight) > StandingLimit && Mathf.Abs(phidgetManager.verticalWeight) > StandingLimit) { PersonOnBoard = true; } if (PersonOnBoard && !CountDownFinished) { StartCoroutine(Countdown()); } // Start Countdown End ---------------------------------------------------------------------- // End of Game Screen Start ---------------------------------------------------------------------- GameObject hips = GameObject.Find("mixamorig:Hips"); Segment_Instancing segment_Instancing = hips.GetComponent <Segment_Instancing>(); if (segment_Instancing.NoMovement) { GameOver = true; ControlOn = false; HighScoreText.text = ""; GameOverText.text = "you tried."; GameOverHighScoreText.text = "your highscore was " + HighScoreCombined.ToString(); TryAgainText.text = "to try again please step off the board"; } if (CombinedWeight < 0.5f && segment_Instancing.NoMovement) { Debug.Log("RELOAD LEVEL"); ThisBoolIsUseless = true; } if (ThisBoolIsUseless) { StartCoroutine(LoadGame()); //LoadGame(); //THIS SHOULDNT FIX IT } // End of Game Screen End ---------------------------------------------------------------------- }
public override void OnClosing() { Rfid.Tag -= RfidTag; Rfid.TagLost -= LostRfidTag; Rfid.Attach -= RfidAttach; Rfid.Detach -= RfidDetach; PhidgetManager.Release <RFID>(ref Rfid); }
public override void OnLoad() { Ir = PhidgetManager.Get <IR>(throwIfNotAttached: false); Ir.Code += ir_Code; Ir.Attach += ir_Attach; Ir.Detach += ir_Detach; CheckCanSave(); }
protected override void OnDisabled(DisabledEventArgs e) { ir.Code -= ir_Code; // only release if we aren't going into the configuration menu if (!e.IsConfiguring) { PhidgetManager.Release <IR>(ref ir); } }
protected override void OnDisabled(DisabledEventArgs e) { sensor.TemperatureChange -= TemperatureChange; // only release if we aren't going into the configuration menu if (!e.IsConfiguring) { PhidgetManager.Release <TemperatureSensor>(ref sensor); } }
protected override void OnDisabled(DisabledEventArgs e) { rfid.Tag -= RfidTag; rfid.TagLost -= LostRfidTag; if (!e.IsConfiguring) { PhidgetManager.Release <RFID>(ref rfid); } }
public void TestTwoInterfaceKitsAreEqual() { var k1 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); var k2 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); Assert.AreEqual(k1, k2); PhidgetManager.Release <InterfaceKit>(ref k1); PhidgetManager.Release <InterfaceKit>(ref k2); }
private void FixedUpdate() { // Balanceboard Controls if (ControlOn) { GameObject Ch11_nonPBR = GameObject.Find("Ch11_nonPBR"); PhidgetManager phidgetManager = Ch11_nonPBR.GetComponent <PhidgetManager>(); HorizontalMove = phidgetManager.horizontalWeight / resistance; VerticalMove = phidgetManager.verticalWeight / resistance; } //Pfeiltasten Controls //float HorizontalMove = Input.GetAxis("Horizontal"); // float VerticalMove = Input.GetAxis("Vertical"); // Richtung für zusätzliche Kraft Vector3 direction = new Vector3(HorizontalMove, 0, VerticalMove); //Force PlayerRigid.AddForce(direction * speed); //Boost on Button B if (Input.GetKeyDown(KeyCode.B)) { transform.position = transform.position + new Vector3(0, 5, 0); } // Highscore berechnen & anzeigen if (CountDownFinished) { foreach (Transform item in transform) { if (item.name == "mixamorig:Hips") { HighScoreMeter = Mathf.RoundToInt(item.position.z / 3); } } HighScoreText.text = HighScoreCombined.ToString(); } else { HighScoreText.text = ""; } HighScoreCombined = HighScoreMeter + HighScoreCoin; }
public void TestOneKitReleaseIsNullified() { var k1 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); var k2 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); PhidgetManager.Release <InterfaceKit>(ref k1); Assert.IsNull(k1); Assert.AreEqual(1, PhidgetManager.GetReferenceCount <InterfaceKit>()); Assert.AreNotEqual(k1, k2); PhidgetManager.Release <InterfaceKit>(ref k2); }
public override void OnLoad() { // Get the RFID object, even if it isn't attached. Rfid = PhidgetManager.Get <RFID>(throwIfNotAttached: false); Rfid.Tag += RfidTag; Rfid.TagLost += LostRfidTag; Rfid.Attach += RfidAttach; Rfid.Detach += RfidDetach; SetAttached(); }
public override void OnLoad() { sensor = PhidgetManager.Get <TemperatureSensor>(false); sensor.Attach += sensor_Attach; sensor.Detach += sensor_Detach; sensor.TemperatureChange += sensor_TemperatureChange; textBoxTopValue.Text = TopValue.ToString(); IncreasingRadio.IsChecked = Increasing; DecreasingRadio.IsChecked = !Increasing; SetAttached(); CheckCanSave(); }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { IfKit.Attach -= IfKit_Attach; if (InterfaceKitType == InterfaceKitType.Input) { IfKit.InputChange -= InputChange; } else if (InterfaceKitType == InterfaceKitType.Sensor) { IfKit.SensorChange -= SensorChange; } PhidgetManager.Release <InterfaceKit>(ref IfKit); }
public void TestTwoInterfaceKitsOneWithEventAreEqual() { var k1 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); k1.Attach += delegate(object sender, AttachEventArgs e) { }; var k2 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); Assert.AreEqual(k1, k2); Assert.AreSame(k1, k2); PhidgetManager.Release <InterfaceKit>(ref k1); PhidgetManager.Release <InterfaceKit>(ref k2); }
protected override void OnEnabling(EnablingEventArgs e) { if (!e.WasConfiguring) { try { ifKit = PhidgetManager.Get <InterfaceKit>(); } catch (InvalidOperationException) { ErrorLog.AddError(ErrorType.Failure, "The interface kit is not attached"); e.Cancel = true; return; } } }
protected override void OnEnabling(EnablingEventArgs e) { // If we weren't just configuring, open the sensor if (!e.WasConfiguring) { try { ir = PhidgetManager.Get <IR>(); } catch (InvalidOperationException) { ErrorLog.AddError(ErrorType.Failure, "The IR Phidget is not attached"); e.Cancel = true; return; } } }
protected override void OnEnabling(EnablingEventArgs e) { if (!e.WasConfiguring) { try { rfid = PhidgetManager.Get <RFID>(); } catch (InvalidOperationException) { ErrorLog.AddError(ErrorType.Failure, "The RFID receiver is not attached"); e.Cancel = true; return; } } rfid.Tag += RfidTag; rfid.TagLost += LostRfidTag; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { IfKit = PhidgetManager.Get <InterfaceKit>(false); IfKit.Attach += IfKit_Attach; if (InterfaceKitType == InterfaceKitType.Input) { IfKit.InputChange += InputChange; } else if (InterfaceKitType == InterfaceKitType.Sensor) { IfKit.SensorChange += SensorChange; } if (IfKit.Attached) { SetUpSensorBox(); } }
protected override void OnEnabling(EnablingEventArgs e) { if (!e.WasConfiguring) { try { advServo = PhidgetManager.Get <AdvancedServo>(); foreach (AdvancedServoServo servo in advServo.servos) { servo.Engaged = true; servo.SpeedRamping = false; } } catch (InvalidOperationException) { ErrorLog.AddError(ErrorType.Failure, "The Phidget servo controller is not attached"); e.Cancel = true; return; } } }
public override void OnLoad() { IfKit = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); SensorDataBox.InterfaceKitType = type; SensorDataBox.Index = Index; SensorDataBox.Convertor = Convertor; Sensor.OnLoad(); Sensor.OnRevalidate += Revalidate; sensorControl.Content = Sensor; IfKit.Attach += ifKit_Attach; IfKit.Detach += IfKit_Detach; Revalidate(); shouldCheckValidity = true; CheckCanSave(); }
public void TestOneKitThrowOnNotAttachIsOneCount() { InterfaceKit k1 = null; try { k1 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: true); // We shouldn't get this far, since we did, we have to release this otherwise // We will break other tests PhidgetManager.Release <InterfaceKit>(ref k1); Assert.Fail("Shouldn't get here, Interface kit should not be attached for this test"); } catch (InvalidOperationException) { } Assert.AreEqual(0, PhidgetManager.GetReferenceCount <InterfaceKit>()); var k2 = PhidgetManager.Get <InterfaceKit>(throwIfNotAttached: false); Assert.AreEqual(1, PhidgetManager.GetReferenceCount <InterfaceKit>()); PhidgetManager.Release <InterfaceKit>(ref k2); Assert.AreEqual(0, PhidgetManager.GetReferenceCount <InterfaceKit>()); }
// Start is called before the first frame update void Start() { localPhidgetsmanager = PhidgetsManager.GetComponent <PhidgetManager>(); // get reference of remote script mytext = gameObject.GetComponent <Text>(); }