public void Refresh() { if (equippedGear != null) { icon.enabled = true; icon.sprite = equippedGear.art; } else { icon.enabled = false; } foreach (EquipmentSlot slot in dependants) { if (equippedGear != null) { //check if the slot is of a type that the equipped gear doesn't provide if (Array.IndexOf(equippedGear.DoesntProvide, GearLoadout.GetSlotType(slot.SlotID)) > -1) { slot.gameObject.SetActive(false); } else { slot.gameObject.SetActive(gameObject.activeSelf); } } else { slot.gameObject.SetActive(false); } slot.Refresh(); } }
public void SubtractLoadout(GearLoadout loadout) { List <GearData> gearInLoadout = loadout.ToList(); foreach (GearData gear in gearInLoadout) { RemoveGear(gear); } }
private void UpdateDependants(bool enabled, InventoryCollection inventory) { foreach (EquipmentSlot slot in dependants) { bool setgear = false; if (enabled) { slot.gameObject.SetActive(true); if (equippedGear != null) { //check if the slot is of a type that the equipped gear doesn't provide if (Array.IndexOf(equippedGear.DoesntProvide, GearLoadout.GetSlotType(slot.SlotID)) > -1) { slot.SetEquippedGear(null, inventory); setgear = true; slot.gameObject.SetActive(false); } } else { slot.SetEquippedGear(null, inventory); slot.gameObject.SetActive(false); setgear = true; } } else { slot.SetEquippedGear(null, inventory); slot.gameObject.SetActive(false); setgear = true; } if (!setgear) { slot.UpdateDependants(enabled, inventory); } } }