public void RemoveLimb(Limb.LimbType type) { //Damage for taking it health -= 10; if (type == Limb.LimbType.LEFTARM) { leftArm.state = Limb.InjuryClass.LOST; } else if (type == Limb.LimbType.LEFTLEG) { leftLeg.state = Limb.InjuryClass.LOST; } else if (type == Limb.LimbType.RIGHTARM) { rightArm.state = Limb.InjuryClass.LOST; } else if (type == Limb.LimbType.RIGHTLEG) { rightLeg.state = Limb.InjuryClass.LOST; } //If all limbs removed kill victim if (leftArm.state == Limb.InjuryClass.LOST && leftLeg.state == Limb.InjuryClass.LOST && rightArm.state == Limb.InjuryClass.LOST && rightLeg.state == Limb.InjuryClass.LOST) { state = VicState.DEAD; } }
public void GiveLimb(Limb.LimbType type) { if (type == Limb.LimbType.LEFTARM) { leftArm.state = Limb.InjuryClass.FINE; leftArm.hasChanged = true; } else if (type == Limb.LimbType.LEFTLEG) { leftLeg.state = Limb.InjuryClass.FINE; leftLeg.hasChanged = true; } else if (type == Limb.LimbType.RIGHTARM) { rightArm.state = Limb.InjuryClass.FINE; rightArm.hasChanged = true; } else if (type == Limb.LimbType.RIGHTLEG) { rightLeg.state = Limb.InjuryClass.FINE; rightLeg.hasChanged = true; } //If all limbs removed kill victim if (leftArm.state == Limb.InjuryClass.FINE && leftLeg.state == Limb.InjuryClass.FINE && rightArm.state == Limb.InjuryClass.FINE && rightLeg.state == Limb.InjuryClass.FINE) { state = VicState.SAVED; } }
void Update() { //TEMP leftArmTxt.text = "Left Arm " + leftArm.GetClass(); if (leftArm.state == Limb.InjuryClass.FINE) { leftArmTxt.color = Color.green; } else if (leftArm.state == Limb.InjuryClass.INJURED) { leftArmTxt.color = Color.yellow; } else if (leftArm.state == Limb.InjuryClass.LOST) { leftArmTxt.color = Color.red; } leftLegTxt.text = "Left Leg " + leftLeg.GetClass(); if (leftLeg.state == Limb.InjuryClass.FINE) { leftLegTxt.color = Color.green; } else if (leftLeg.state == Limb.InjuryClass.INJURED) { leftLegTxt.color = Color.yellow; } else if (leftLeg.state == Limb.InjuryClass.LOST) { leftLegTxt.color = Color.red; } rightArmTxt.text = "Right Arm " + rightArm.GetClass(); if (rightArm.state == Limb.InjuryClass.FINE) { rightArmTxt.color = Color.green; } else if (rightArm.state == Limb.InjuryClass.INJURED) { rightArmTxt.color = Color.yellow; } else if (rightArm.state == Limb.InjuryClass.LOST) { rightArmTxt.color = Color.red; } rightLegTxt.text = "Right Leg " + rightLeg.GetClass(); if (rightLeg.state == Limb.InjuryClass.FINE) { rightLegTxt.color = Color.green; } else if (rightLeg.state == Limb.InjuryClass.INJURED) { rightLegTxt.color = Color.yellow; } else if (rightLeg.state == Limb.InjuryClass.LOST) { rightLegTxt.color = Color.red; } if (leftArm.state == Limb.InjuryClass.INJURED) { health -= injuredDamage; } else if (leftArm.state == Limb.InjuryClass.LOST) { health -= lostDamage; } if (leftLeg.state == Limb.InjuryClass.INJURED) { health -= injuredDamage; } else if (leftLeg.state == Limb.InjuryClass.LOST) { health -= lostDamage; } if (rightArm.state == Limb.InjuryClass.INJURED) { health -= injuredDamage; } else if (rightArm.state == Limb.InjuryClass.LOST) { health -= lostDamage; } if (rightLeg.state == Limb.InjuryClass.INJURED) { health -= injuredDamage; } else if (rightLeg.state == Limb.InjuryClass.LOST) { health -= lostDamage; } healthBar.fillAmount = health / healthMax; //Check for death if (health <= 0) { state = VicState.DEAD; } //Fix for heal issue if (leftArm.state == Limb.InjuryClass.FINE && leftLeg.state == Limb.InjuryClass.FINE && rightArm.state == Limb.InjuryClass.FINE && rightLeg.state == Limb.InjuryClass.FINE) { state = VicState.SAVED;// redundancy issue between saved and living was stopping people from being saved. } }
void Update() { int check = 0; if (leftArm.state == Limb.InjuryClass.FINE) { check += 1; } else if (leftArm.state == Limb.InjuryClass.INJURED) { health -= 1; } else if (leftArm.state == Limb.InjuryClass.LOST) { health -= 3; } if (leftLeg.state == Limb.InjuryClass.FINE) { check += 1; } else if (leftLeg.state == Limb.InjuryClass.INJURED) { health -= 1; } else if (leftLeg.state == Limb.InjuryClass.LOST) { health -= 3; } if (rightArm.state == Limb.InjuryClass.FINE) { check += 1; } else if (rightArm.state == Limb.InjuryClass.INJURED) { health -= 1; } else if (rightArm.state == Limb.InjuryClass.LOST) { health -= 3; } if (rightLeg.state == Limb.InjuryClass.FINE) { check += 1; } else if (rightLeg.state == Limb.InjuryClass.INJURED) { health -= 1; } else if (rightLeg.state == Limb.InjuryClass.LOST) { health -= 3; } //Check for save if (check == 4) { state = VicState.SAVED; } //Check for death if (health <= 0) { state = VicState.DEAD; } }