private void UpdateEquipment() { var equipmentCarrier = Actor.Person.EquipmentCarrier; for (var slotIndex = 0; slotIndex < equipmentCarrier.Slots.Length; slotIndex++) { var slot = equipmentCarrier.Slots[slotIndex]; var types = slot.Types; VisualPropHolder holder; if (_visualSlots.TryGetValue(slotIndex, out holder)) { foreach (Transform visualProp in holder.transform) { Destroy(visualProp.gameObject); } VisualProp visualPropResource = null; var equipment = equipmentCarrier.Equipments[slotIndex]; if (equipment != null) { visualPropResource = Resources.Load <VisualProp>($"VisualProps/{equipment.Scheme.Sid}"); } if (visualPropResource != null) { Instantiate(visualPropResource, holder.transform); } } } }
private void UpdateEquipment() { var equipmentCarrier = Actor.Person.GetModule <IEquipmentModule>(); for (var slotIndex = 0; slotIndex < equipmentCarrier.Slots.Length; slotIndex++) { if (_visualSlots.TryGetValue(slotIndex, out VisualPropHolder holder)) { foreach (Transform visualProp in holder.transform) { Destroy(visualProp.gameObject); } VisualProp visualPropResource = null; var equipment = equipmentCarrier[slotIndex]; if (equipment != null) { var schemeSid = equipment.Scheme.Sid; if (equipment.Scheme.IsMimicFor != null) { schemeSid = equipment.Scheme.IsMimicFor; } visualPropResource = Resources.Load <VisualProp>($"VisualProps/{schemeSid}"); } if (visualPropResource != null) { Instantiate(visualPropResource, holder.transform); } else { if ((holder.SlotTypes & EquipmentSlotTypes.Body) > 0) { var noneArmor = Resources.Load <VisualProp>($"VisualProps/none-armor"); Instantiate(noneArmor, holder.transform); } else if ((holder.SlotTypes & EquipmentSlotTypes.Head) > 0) { var noneHead = Resources.Load <VisualProp>($"VisualProps/none-head"); Instantiate(noneHead, holder.transform); } } } } }