public void UseItem(ItemBase item) { if (item != null) { Debug.Log("Item is: " + item); ItemsDescription description = item.itemProperties.itemDescription; Corrosion c = GetComponentInParent <Corrosion>(); if (c != null && description != null) { if (description.GetItemType().GetType() == (typeof(AcidsList))) { //Corrode the item based on it's pH value.....Lesser pH, more corrosion //100 will be taken as a reference to calculate corrosion damage to all the platforms Debug.Log("Trying to corrode"); float value = (1 / (float)((description.pHValue) + 1)) * 100; c.Corrode(value); } else if (description.GetItemType().GetType() == (typeof(BasesList))) { //Corrode the item based on it's pH value.....Higher pH, more corrosion //100 will be taken as a reference to calculate corrosion damage to all the platforms int alteratedpH = 7 - (description.pHValue - 7); float value = (1 / ((alteratedpH) + 1)) * 100; c.Corrode(value); } } else { Debug.Log("Dude....There is no corrosion"); } } }