public void rotates_waypoint_left(int angle, int expectedNorth, int expectedEast) { var command = new Left2(angle); var result = command.Move(StartingPositions); result.Ship.North.Should().Be(0); result.Ship.East.Should().Be(0); result.Waypoint.North.Should().Be(expectedNorth); result.Waypoint.East.Should().Be(expectedEast); }
private void GetListDelivery(int pageIndex, int pageSize) { try { _DeliveryList = null; DeliveryIndexInput qsom = InitDeliveryIndexInput(); string msg = string.Empty; var c = PharmacyDatabaseService.GetDeliveryPaged(out pageInfo, out msg, qsom, pageIndex, pageSize); var result = from ds in ListStatus join i in c on ds.num equals i.DeliveryStatusValue join u in ListUser on i.AcceptedOperatorId equals u.Id into Left1 from u in Left1.DefaultIfEmpty() join u1 in ListUser on i.outedOperatorId equals u1.Id into Left2 from u1 in Left2.DefaultIfEmpty() join u2 in ListUser on i.SignedOperatorId equals u2.Id into Left3 from u2 in Left3.DefaultIfEmpty() select new Business.Models.DeliveryModel { AcceptedOperator = u == null ? "未受理" : u.Employee.Name, AcceptedTime = u == null ? i.CreateTime : i.AcceptedTime, DeliveryAddress = i.DeliveryAddress, DeliveryMethod = u == null ? "未受理" : (i.DeliveryMethodValue == 0 ? "客户自理" : i.DeliveryMethodValue == 1 ? "自有车辆运输" : "委托运输"), DeliveryStatus = ds.nam, DrugsCount = i.DrugsCount, ID = i.Id, outedOperator = u1 == null ? "未出库" : u1.Employee.Name, outedTime = u1 == null ? i.CreateTime : i.outedTime, Principal = u == null ? string.Empty : i.Principal, PrincipalPhone = u == null ? string.Empty : i.PrincipalPhone, ReceivingCompasnyID = i.ReceivingCompasnyID, ReceivingCompasnyName = i.ReceivingCompasnyName, SalesOrderID = i.OrderID, SalesOrderNumber = i.SalesOrder, ShippingAddress = i.ShippingAddress, SignedOperator = u2 == null ? "未签收" : u2.Employee.Name, SignedTime = u2 == null ? i.CreateTime : i.SignedTime, TransportCompany = u == null ? string.Empty : i.TransportCompany, TransportMethod = u == null ? "未受理" : (i.TransportMethodValue == 0 ? "客户自理" : i.TransportMethodValue == 1 ? "自有车辆运输" : "委托运输"), VehicleInfo = u == null ? string.Empty : i.VehicleInfo, Memo = i.Memo }; this.dgvMain.DataSource = result.ToList(); pcMain.RecordCount = pageInfo.RecordCount; this.HideColumns(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK); Log.Error(ex); } }
/// <summary> /// Initializes the AutoHandler. /// </summary> protected override void Init() { // Instantiates AutoHandler. AutoHandler = new Handler(); //Sets the CAN Talons to rely off of the encoders for movement. AutoFunctions.ConfigureTalon(Right1, ConfigureType.Position, new EncoderParameters { AllowedError = 0, Device = CANTalon.FeedbackDevice.CtreMagEncoderRelative, NominalVoltage = 0.0f, PeakVoltage = 12.0f, PIDFValues = new PIDF { kP = 0.151, kI = 0, kD = 0, kF = 0 }, ReverseSensor = false }); AutoFunctions.ConfigureTalon(Left1, ConfigureType.Position, new EncoderParameters { AllowedError = 0, Device = CANTalon.FeedbackDevice.CtreMagEncoderRelative, NominalVoltage = 0.0f, PeakVoltage = 12.0f, //3.4f PIDFValues = new PIDF { kP = 0.151, kI = 0, kD = 0, kF = 0 }, ReverseSensor = true }); Right1.SetEncoderPostition(0); // Reset the encoder position to 0. Right1.ReverseOutput(true); // Reverse the direction of the motor. Right2.MotorControlMode = WPILib.Interfaces.ControlMode.Follower; Right2.Set(Right1.DeviceId); // Configure the second right talon to be a follower of the other right talon. Left1.SetEncoderPostition(0); // Reset the eoncoder position to 0. Left1.ReverseOutput(false); // Reverse the direction of the motor. Left1.ReverseSensor(true); Left2.MotorControlMode = WPILib.Interfaces.ControlMode.Follower; Left2.Set(Left1.DeviceId); // Configure the second left talon to be a follower of the other left talon. NavX.Reset(); // Reset the NavX's yaw value to zero. }
// Update is called once per frame void Update() { if (Carl == null) { Carl = Instruction.GetComponent <RandomInstruction>(); } if (SHealth <= 0) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); GameOverScreen.SetActive(true); GameOverMusic.SetActive(true); if (UFB == true) { SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1200; EnemyHealth.text = EHealth.ToString(); } else if (BabyMode == true) { SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 200; EnemyHealth.text = EHealth.ToString(); } else { SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } } if (EHealth <= 0) { if (BabyMode == true) { if (AreYouMrDark == true) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Dvic1.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 200; EnemyHealth.text = EHealth.ToString(); } else if (AreYouMrDark == false) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Lvic1.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 200; EnemyHealth.text = EHealth.ToString(); } } else if (Easy == true) { if (AreYouMrDark == true) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Dvic2.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } else if (AreYouMrDark == false) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Lvic2.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } } else if (Medium == true) { if (AreYouMrDark == true) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Dvic3.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } else if (AreYouMrDark == false) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Lvic3.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } } else if (Excruciatinglyhard == true) { if (AreYouMrDark == true) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Dvic4.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } else if (AreYouMrDark == false) { Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); Lvic4.SetActive(true); VictoryMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1000; EnemyHealth.text = EHealth.ToString(); } } else if (UFB == true) { if (AreYouMrDark == true) { Debug.Log("made it here dark"); Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); UltEndingDark.SetActive(true); UltEndingMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1200; EnemyHealth.text = EHealth.ToString(); } else if (AreYouMrDark == false) { Debug.Log("made it here light"); Gameplay.SetActive(false); MrPersonGameObject.SetActive(false); MrPersonMusic.SetActive(false); UltEndingLight.SetActive(true); UltEndingMusic.SetActive(true); SHealth = 1000; ShipHealth.text = SHealth.ToString(); EHealth = 1200; EnemyHealth.text = EHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.W)) //Attack { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(false); Left1.SetActive(false); Left2.SetActive(true); Left3.SetActive(false); Right1.SetActive(false); Right2.SetActive(false); Right3.SetActive(false); if (Carl.InstructionBoolArray[3] == true) { EHealth -= Damage; EnemyHealth.text = EHealth.ToString(); } else { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= Damage; ShipHealth.text = SHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.A)) //Move Left { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(true); RightButtonPress.SetActive(false); Left1.SetActive(false); Left2.SetActive(false); Left3.SetActive(false); Right1.SetActive(false); Right2.SetActive(false); Right3.SetActive(false); if (Carl.InstructionBoolArray[0] == false) { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= MinorDamage; ShipHealth.text = SHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.S)) //Shields { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(false); Left1.SetActive(false); Left2.SetActive(false); Left3.SetActive(false); Right1.SetActive(false); Right2.SetActive(true); Right3.SetActive(false); if (Carl.InstructionBoolArray[6] == true) { Shields = true; ShieldStatus.text = "ON"; } else { if (Shields == true) { Shields = false; } else { SHealth -= MinorDamage; ShipHealth.text = SHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.D)) //MoveRight { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(true); Left1.SetActive(false); Left2.SetActive(false); Left3.SetActive(false); Right1.SetActive(false); Right2.SetActive(false); Right3.SetActive(false); if (Carl.InstructionBoolArray[1] == false) { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= MinorDamage; ShipHealth.text = SHealth.ToString(); } } else { ShipHealth.text = SHealth.ToString(); } } if (Input.GetKeyDown(KeyCode.Space)) //Restore Health { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(false); Left1.SetActive(false); Left2.SetActive(false); Left3.SetActive(true); Right1.SetActive(false); Right2.SetActive(false); Right3.SetActive(false); if (Carl.InstructionBoolArray[4] == true) { if (SHealth + 8 < 1000) { SHealth += 8; ShipHealth.text = SHealth.ToString(); } else { SHealth = 1000; ShipHealth.text = SHealth.ToString(); } } else { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= MinorDamage; ShipHealth.text = SHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.Q)) //Recharge Oxygen { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(false); Left1.SetActive(false); Left2.SetActive(false); Left3.SetActive(false); Right1.SetActive(true); Right2.SetActive(false); Right3.SetActive(false); if (Carl.InstructionBoolArray[5] == true) { if (SHealth + 4 < 1000) { SHealth += 4; ShipHealth.text = SHealth.ToString(); } else { SHealth = 1000; ShipHealth.text = SHealth.ToString(); } } else { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= MinorDamage; ShipHealth.text = SHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.E)) //Hyperspace Jump { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(false); Left1.SetActive(false); Left2.SetActive(false); Left3.SetActive(false); Right1.SetActive(false); Right2.SetActive(false); Right3.SetActive(true); if (Carl.InstructionBoolArray[7] == false) { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= MinorDamage; ShipHealth.text = SHealth.ToString(); } } } if (Input.GetKeyDown(KeyCode.R)) //Big Red Button { PressedButton = true; MrPerson.SetActive(false); LeftButtonPress.SetActive(false); RightButtonPress.SetActive(false); Left1.SetActive(true); Left2.SetActive(false); Left3.SetActive(false); Right1.SetActive(false); Right2.SetActive(false); Right3.SetActive(false); if (Carl.InstructionBoolArray[2] == true) { EHealth -= Damage * 2; EnemyHealth.text = EHealth.ToString(); } else { if (Shields == true) { Shields = false; ShieldStatus.text = "OFF"; } else { SHealth -= Damage * 2; ShipHealth.text = SHealth.ToString(); } } } }