public bool EquipArms(Armament arms, Slot intoSlot) { //get the equipped into slots arms.EquipRequirements(this, intoSlot, out Slot[] usedSlots, out _); //try to stop all arms in those slots foreach (Slot usedSlot in usedSlots) { ArmamentPrefab current = GetArms(usedSlot); if (current != null && CanUnequip() == false) { return(false); } } //finally, spawn/despawn prefab and update references ArmamentPrefab prefab = arms.SpawnPrefab(this, equipmentParent, usedSlots, equipmentTransforms); foreach (Slot usedSlot in usedSlots) { UnequipArms(usedSlot); equippedArms[(int)usedSlot] = prefab; OnEquipmentUpdate?.Invoke(usedSlot, prefab); } return(true); }