//If we bought the penalties, we're going to lose our limbs. void RemoveLimbs() { list = FindObjectOfType <equipmentList>(); for (int i = 0; i < 6; i++) { if (removedLimbs[i]) { list.ChangeEquip(null, (partType)i, -1); } } }
public void addLimb() { combinedShop.Refresh = true; changed = true; GameObject adding; GameObject currentPart = combinedShop.currentPart; //The object, found at the index inside the list. int currentIndex = combinedShop.currentIndex; partType currentType = combinedShop.currentType; if (currentPart == null) { return; } if (currentType == partType.Torso) { addingTorso(); return; } if (TorsoEquipped == null) { return; } switch (currentType) { case partType.Head: if (headEquipped != null && currentPart.name == headEquipped.gameObject.name) { return; } if (headEquipped != null) { Destroy(headEquipped.gameObject); } adding = Instantiate(currentPart, TorsoEquipped.neckForHead.transform, false); headEquipped = adding.GetComponent <ItemPart>(); list.ChangeEquip(currentPart, partType.Head, currentIndex); adding.name = currentPart.name; break; case partType.LeftArm: if (leftArmEquipped != null && currentPart.name == leftArmEquipped.gameObject.name) { return; } if (leftArmEquipped != null) { leftArmEquipped.deleteArm(); } adding = Instantiate(currentPart, TorsoEquipped.LeftArmUpper.transform, false); leftArmEquipped = adding.GetComponent <ArmPart>(); leftArmEquipped.EquipArm(TorsoEquipped, TorsoEquipped.LeftArmUpper, TorsoEquipped.LeftArmFore, TorsoEquipped.LeftArmHand); adding.name = currentPart.name; list.ChangeEquip(currentPart, partType.LeftArm, currentIndex); adding = null; break; case partType.RightArm: if (rightArmEquipped != null && currentPart.name == rightArmEquipped.gameObject.name) { return; } if (rightArmEquipped != null) { rightArmEquipped.deleteArm(); } adding = Instantiate(currentPart, TorsoEquipped.RightArmUpper.transform, false); rightArmEquipped = adding.GetComponent <ArmPart>(); rightArmEquipped.EquipArm(TorsoEquipped, TorsoEquipped.RightArmUpper, TorsoEquipped.RightArmFore, TorsoEquipped.RightArmHand); adding.name = currentPart.name; list.ChangeEquip(currentPart, partType.RightArm, currentIndex); adding = null; break; case partType.LeftLeg: if (leftLegEquipped != null && currentPart.name == leftLegEquipped.gameObject.name) { return; } if (leftLegEquipped != null) { leftLegEquipped.DeleteLeg(); } adding = Instantiate(currentPart, TorsoEquipped.RightUpperThigh.transform, false); leftLegEquipped = adding.GetComponent <LegPart>(); leftLegEquipped.EquipLeg(TorsoEquipped.LeftUpperThigh, TorsoEquipped.Leftshin, TorsoEquipped.LefttAnkle, TorsoEquipped.LeftFoot); list.ChangeEquip(currentPart, partType.LeftLeg, currentIndex); adding.name = currentPart.name; adding = null; break; case partType.RightLeg: if (rightLegEquipped != null && currentPart.name == rightLegEquipped.gameObject.name) { } if (rightLegEquipped != null) { rightLegEquipped.DeleteLeg(); } adding = Instantiate(currentPart, TorsoEquipped.RightUpperThigh.transform, false); rightLegEquipped = adding.GetComponent <LegPart>(); rightLegEquipped.EquipLeg(TorsoEquipped.RightUpperThigh, TorsoEquipped.Rightshin, TorsoEquipped.RightAnkle, TorsoEquipped.RightFoot); list.ChangeEquip(currentPart, partType.RightLeg, currentIndex); adding.name = currentPart.name; adding = null; break; default: break; } if (TorsoEquipped.bodyType == BodyType.FourArm) { Destroy(TorsoEquipped.gameObject); list.BuildCharacter(parentOfTorso, this); return; } }