Esempio n. 1
0
 // Set up + Initialization
 #region
 public void BuilFromConsumableData(ConsumableDataSO data)
 {
     myData                = data;
     myImage.sprite        = data.consumableSprite;
     nameText.text         = data.consumableName;
     desccriptionText.text = data.consumableDescription;
 }
Esempio n. 2
0
    public void BuildFromData(ConsumableDataSO data)
    {
        myData               = data;
        myImage.sprite       = data.consumableSprite;
        goldCost             = Random.Range(5, 11);
        goldCostText.text    = goldCost.ToString();
        descriptionText.text = data.consumableDescription;
        nameText.text        = data.consumableName;

        EnableSlotView();
    }
Esempio n. 3
0
    public void StartGainConsumableProcess(ConsumableDataSO data)
    {
        Debug.Log("ConsumableManager.StartGainConsumableProcess() called for " + data.consumableName);

        // Check if gaining a consumable if actually possible (all slots full?)
        if (HasAtleastOneSlotAvailble())
        {
            Debug.Log("Player meets all conditions for gaining consumable...");
            GainConsumable(data);
        }
        else
        {
            Debug.Log("Player does not meet the requirments to gain a consumable...");
        }
    }
Esempio n. 4
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();
    }
Esempio n. 5
0
    public ConsumableDataSO GetConsumableDataByName(string name)
    {
        Debug.Log("ConsumableLibrary.GetConsumableDataByName() called, searching for: " + name);

        ConsumableDataSO dataReturned = null;

        foreach (ConsumableDataSO data in allConsumables)
        {
            if (data.consumableName == name)
            {
                dataReturned = data;
                break;
            }
        }

        if (dataReturned == null)
        {
            Debug.Log("ConsumableLibrary.GetConsumableDataByName() could not find a consumable with the name '" +
                      name + "', returning null...");
        }

        return(dataReturned);
    }
Esempio n. 6
0
 public void InitializeSetup()
 {
     myData = ConsumableLibrary.Instance.GetRandomConsumable();
     consumableImage.sprite  = myData.consumableSprite;
     consumableNameText.text = myData.consumableName;
 }