public ConsumableTopPanelSlot GetNextAvailableSlot() { Debug.Log("ConsumableManager.GetNextAvailableSlot() called..."); ConsumableTopPanelSlot slotReturned = null; if (!slotOne.occupied) { Debug.Log("ConsumableManager.GetNextAvailableSlot() returning Slot One..."); slotReturned = slotOne; } else if (!slotTwo.occupied) { Debug.Log("ConsumableManager.GetNextAvailableSlot() returning Slot Two..."); slotReturned = slotTwo; } else if (!slotThree.occupied) { Debug.Log("ConsumableManager.GetNextAvailableSlot() returning Slot Three..."); slotReturned = slotThree; } else { Debug.Log("ConsumableManager.GetNextAvailableSlot() could not find an availble slot, returning null..."); } return(slotReturned); }
public void GainConsumable(ConsumableDataSO data) { Debug.Log("ConsumableManager.GainConsumable() called, gaining " + data.consumableName); // Create GO and set slot parent ConsumableTopPanelSlot slot = GetNextAvailableSlot(); GameObject newConsGO = Instantiate(PrefabHolder.Instance.consumable, slot.gameObject.transform); Consumable consumable = newConsGO.GetComponent <Consumable>(); consumable.BuilFromConsumableData(data); activeConsumables.Add(consumable); // Modify slot availability consumable.mySlot = slot; slot.occupied = true; slot.HideSlotView(); }