public bool CanMoveArm(RobotVO robot, ArmVO armMoved, ArmSide armSide) { ArmVO arm = armSide == ArmSide.Left ? robot.LeftArm : robot.RightArm; bool isElbowMovement = IsElbowMovement(arm, armMoved.Elbow); bool isWristMovement = IsWristMovement(arm, armMoved.Wrist); // Não se pode mexer mais de uma parte do braço por vez if (isElbowMovement && isWristMovement) { return(false); } if (isElbowMovement) { return(ChangeElbowMovement(arm, armMoved.Elbow)); } if (isWristMovement) { return(ChangeWristMovement(arm, armMoved.Wrist)); } //Não houve mudança return(true); }
internal void UpdateAmmoUI(ArmSide armSide, char index, int currAmmo, int maxAmmo, int playerID) { if (ui_Players[playerID] != null) { ui_Players[playerID].UpdateAmmoUI(armSide, index, currAmmo, maxAmmo); } }
public void Initialize(ArmSide WhichSide, GameObject ShoulderMount, VRObjectMimic TrackerMount, VRObjectMimic ControllerConnection) { name = "Arm Mimic [" + WhichSide.ToString() + "]"; this.WhichArm = WhichSide; this.ShoulderMount = ShoulderMount; this.TrackerMount = TrackerMount; this.ControllerConnection = ControllerConnection; SetArmColliderAreaFlags(); MimicEnabled = true; AttemptReenable = false; }
/// <summary> /// Update the UI to show which arm is currently equipped /// </summary> /// <param name="armType"> Front or back arm </param> /// <param name="index"> Weapon index being updated </param> public void UpdateSelectedUI(ArmSide armType, char index) { // If back arm, update if (armType == ArmSide.Back) { // Deselect previous arm if (previous_L_select) { previous_L_select.enabled = false; } // Select new arm switch (index) { case 'A': weaponA_L_select.enabled = true; previous_L_select = weaponA_L_select; break; case 'B': weaponB_L_select.enabled = true; previous_L_select = weaponB_L_select; break; case 'C': weaponC_L_select.enabled = true; previous_L_select = weaponC_L_select; break; case 'D': weaponD_L_select.enabled = true; previous_L_select = weaponD_L_select; break; } } // If front arm, update else if (armType == ArmSide.Front) { // Deselect previous arm if (previous_R_select) { previous_R_select.enabled = false; } // Select new arm switch (index) { case 'A': weaponA_R_select.enabled = true; previous_R_select = weaponA_R_select; break; case 'B': weaponB_R_select.enabled = true; previous_R_select = weaponB_R_select; break; case 'C': weaponC_R_select.enabled = true; previous_R_select = weaponC_R_select; break; case 'D': weaponD_R_select.enabled = true; previous_R_select = weaponD_R_select; break; } } }
/// <summary> /// Update the UI to show how much ammo a single weapon has /// </summary> /// <param name="armType"> Front or back arm </param> /// <param name="index"> Weapon index being updated </param> /// <param name="currAmmo"> Current ammo the weapon has </param> /// <param name="maxAmmo"> Max ammo the weapon can have </param> public void UpdateAmmoUI(ArmSide armType, char index, int currAmmo, int maxAmmo) { // If back arm, update if (armType == ArmSide.Back) { switch (index) { case 'A': weaponA_L_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponA_L_ammo.color = Color.green; } else if (currAmmo == 0) { weaponA_L_ammo.color = Color.red; } else { weaponA_L_ammo.color = Color.white; } break; case 'B': weaponB_L_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponB_L_ammo.color = Color.green; } else if (currAmmo == 0) { weaponB_L_ammo.color = Color.red; } else { weaponB_L_ammo.color = Color.white; } break; case 'C': weaponC_L_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponC_L_ammo.color = Color.green; } else if (currAmmo == 0) { weaponC_L_ammo.color = Color.red; } else { weaponC_L_ammo.color = Color.white; } break; case 'D': weaponD_L_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponD_L_ammo.color = Color.green; } else if (currAmmo == 0) { weaponD_L_ammo.color = Color.red; } else { weaponD_L_ammo.color = Color.white; } break; } } // If front arm, update else if (armType == ArmSide.Front) { switch (index) { case 'A': weaponA_R_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponA_R_ammo.color = Color.green; } else if (currAmmo == 0) { weaponA_R_ammo.color = Color.red; } else { weaponA_R_ammo.color = Color.white; } break; case 'B': weaponB_R_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponB_R_ammo.color = Color.green; } else if (currAmmo == 0) { weaponB_R_ammo.color = Color.red; } else { weaponB_R_ammo.color = Color.white; } break; case 'C': weaponC_R_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponC_R_ammo.color = Color.green; } else if (currAmmo == 0) { weaponC_R_ammo.color = Color.red; } else { weaponC_R_ammo.color = Color.white; } break; case 'D': weaponD_R_ammo.text = currAmmo.ToString(); if (currAmmo == maxAmmo) { weaponD_R_ammo.color = Color.green; } else if (currAmmo == 0) { weaponD_R_ammo.color = Color.red; } else { weaponD_R_ammo.color = Color.white; } break; } } }
private JsonResult ChangeWristPosition(long id, ArmVO arm, int newPositionWristNumeric, ArmSide armSide) { WristMovement newWristMovement; string movementDescription = string.Empty; bool isValidMovement = newPositionWristNumeric.TryParseEnum(out newWristMovement); if (isValidMovement) { arm.Wrist = newWristMovement; movementDescription = arm.Wrist.GetDescription(); bool isArmMoved = armSide == ArmSide.Left ? _robotService.PutLeftArm(id, arm) : _robotService.PutRightArm(id, arm); if (isArmMoved == false) { isValidMovement = false; } } return(Json(new { isValidMovement, description = movementDescription })); }