public void CleanBones(UMAData umaData) { uMAData = gameObject.GetComponentInChildren <UMAData>(); List <UMAJiggleBoneListing> listingsToDelete = new List <UMAJiggleBoneListing>(); KillBones = new List <string>(); AllExceptions = new List <Transform>(); foreach (UMAJiggleBoneListing listing in removalRegister) { string WardrobeItemName = avatar.GetWardrobeItemName(listing.carrierSlot); // lets see if the wardrobe item in the listing is no longer in the slot. // if so, add the bones for the listing to the "kill" list. // and remove this listing from the RemovalRegister (it's already processed and removed from the character) if (WardrobeItemName != listing.recipe) { // make sure no *other* listing is using this bone. KillBones.Add(listing.boneName); listingsToDelete.Add(listing); AllExceptions.AddRange(listing.exceptions); } } foreach (UMAJiggleBoneListing listing in listingsToDelete) { removalRegister.Remove(listing); } // Now that we've got the list of bones to delete, and we've removed them from // the removal register, let's make sure something else isn't using them. foreach (UMAJiggleBoneListing listing in removalRegister) { // remove it if it exists. KillBones.Remove(listing.boneName); } listingsToDelete.Clear(); ProcessBones(gameObject.transform, AllExceptions); }
public void CleanBones(UMAData umaData) { uMAData = gameObject.GetComponentInChildren <UMAData>(); List <UMAJiggleBoneListing> listingsToDelete = new List <UMAJiggleBoneListing>(); foreach (UMAJiggleBoneListing listing in removalRegister) { if (avatar.GetWardrobeItemName(listing.carrierSlot) != listing.recipe) { KillBones.Add(listing.boneName); listingsToDelete.Add(listing); } } foreach (UMAJiggleBoneListing listing in listingsToDelete) { removalRegister.Remove(listing); } listingsToDelete.Clear(); ProcessBones(gameObject.transform); }