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); } }
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; } }
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); }
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); } }
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); } }
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; } }
public void SetData(Consumable_SO con) { this.consumable_SO = con; RedrawUI(); }
void updateConsumableAtIndex(Consumable_SO con, int index) { gridListLayout.transform.GetChild(index).GetChild(0).gameObject.GetComponent <InventoryConsumableUI>().SetData(con); }
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; }
public void ConsumableUpdatedAt(Consumable_SO con, int index) { OnConsumableUpdatedAt(con, index); }
///////////////////////////////////// ////Event Triggers////////////////// public void ConsumableAdded(Consumable_SO con, int index) { OnConsumableAdded(con, index); }