Esempio n. 1
0
        void addConsumable(Consumable_SO con, int index)
        {
            if (gridListLayout.transform.GetChild(index).GetChild(0).gameObject.activeSelf == false)
            {
                gridListLayout.transform.GetChild(index).GetChild(0).gameObject.GetComponent <InventoryConsumableUI>()
                .SetData(con);

                gridListLayout.transform.GetChild(index).GetChild(0).gameObject.SetActive(true);
            }
        }
Esempio n. 2
0
        public void UpdateConsumableData(Consumable_SO con)
        {
            int index = 0;

            foreach (Consumable_SO c in consumables)
            {
                if (c.consumableType == con.consumableType)
                {
                    consumables[index] = con;
                    break;
                }
                index += 1;
            }
        }
Esempio n. 3
0
        Dictionary <bool, int> isDataFoundAt(Consumable_SO con)
        {
            Dictionary <bool, int> foundAt = new Dictionary <bool, int>();
            int index = 0;

            foreach (Consumable_SO c in consumables)
            {
                if (con.consumableType == c.consumableType)
                {
                    foundAt[true] = index;

                    return(foundAt);
                }
                index += 1;
            }
            return(foundAt);
        }
Esempio n. 4
0
        public void USE_Consumable(Consumable_SO type)
        {
            if (type.consumableType == Consumable_SO.ConsumableType.INVISIBILITY)
            {
                OnInvisibilityInUse();
                OnInvisibilityDisabled();
            }
            else if (type.consumableType == Consumable_SO.ConsumableType.HEALTH)
            {
                playerData_SO.player_health = 100;
                EventData_SO.HealthChanged(playerData_SO.player_health);
            }

            else
            {
                OnConsumableInUse(type);
            }
        }
Esempio n. 5
0
        public void addConsumable(Consumable_SO con)
        {
            Dictionary <bool, int> result = isDataFoundAt(con);

            if (result.ContainsKey(true))
            {
                if (con.consumableLevel < 10)
                {
                    con.consumableLevel += 1;
                }


                inventoryEvent_SO.ConsumableUpdatedAt(con, result[true]);
            }
            else
            {
                consumables.Add(con);
                int place = consumables.Count - 1;
                inventoryEvent_SO.ConsumableAdded(con, place);
            }
        }
Esempio n. 6
0
        void OnTriggerEnter(Collider other)
        {
            if (other.CompareTag("Consumable"))
            {
                other.gameObject.SetActive(false);
                StartCoroutine(reE(other.gameObject));

                Consumable_SO con = other.gameObject.GetComponent <ConsumableGameObject>().consumable;


                if (con.consumableType != Consumable_SO.ConsumableType.COIN)
                {
                    inventoryDataStore_SO.addConsumable(con);
                }
                ///Unit test
                playerData.player_health = playerData.player_health - 10;
                EventData_SO.HealthChanged(playerData.player_health);
            }

            if (other.CompareTag("LightFly"))
            {
                playerData.butterfly_is_free = true;
            }
        }
Esempio n. 7
0
 public void SetData(Consumable_SO con)
 {
     this.consumable_SO = con;
     RedrawUI();
 }
Esempio n. 8
0
 void updateConsumableAtIndex(Consumable_SO con, int index)
 {
     gridListLayout.transform.GetChild(index).GetChild(0).gameObject.GetComponent <InventoryConsumableUI>().SetData(con);
 }
Esempio n. 9
0
 void Throw(Consumable_SO con_type)
 {
     //COIN,HEALTH, GRENADE,AXE,INVISIBILITY,SHIELD,POISION_DUST,TAP_AND_FOLLOW_CHARM
     isThrowing = true;
     con_type.consumableLevel -= 0.5f;
 }
Esempio n. 10
0
 public void ConsumableUpdatedAt(Consumable_SO con, int index)
 {
     OnConsumableUpdatedAt(con, index);
 }
Esempio n. 11
0
        /////////////////////////////////////
        ////Event Triggers//////////////////


        public void ConsumableAdded(Consumable_SO con, int index)
        {
            OnConsumableAdded(con, index);
        }