public void LoadItemOnPart(Items.ClothItem item, Items.BodyPart bodyPart) { CharacterPart part = GetPart(bodyPart); if (item == null) { if (bodyPart.isDisabledWhenEmpty) { if (part != null) { part.meshRenderer.enabled = false; } } else { if (part != null) { part.meshRenderer.sharedMesh = part.defaultMesh; part.meshRenderer.material = part.defaultMaterial; part.meshRenderer.enabled = true; } } } else { part.meshRenderer.sharedMesh = item.mesh; part.meshRenderer.material = item.material; part.meshRenderer.enabled = true; } }
public void LoadItemsFromStoredIds() { if (rm == null) { rm = Resources.Load("ResourcesManager") as InventoryFramework.ResourcesManager; } for (int i = 0; i < rm.currentIds.Length; i++) { Items.Item it = rm.GetItemInstance(rm.currentIds[i].instId); if (it == null) { if (rm.currentIds[i].bodyPart.isWeapon) { UnEquipWeapon(rm.currentIds[i].isLeft); } else { LoadItemOnPart(null, rm.currentIds[i].bodyPart); } } else if (it is Items.ClothItem) { Items.ClothItem c = (Items.ClothItem)it; LoadItemOnPart(c, rm.currentIds[i].bodyPart); } else if (it is Items.Weapon) { Items.Weapon w = (Items.Weapon)it; LoadWeapon(w, rm.currentIds[i].isLeft); } } }