Example #1
0
    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();
    }