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"); } } }
public static Corrosion SpawnCorrosion() { Corrosion corrosion = instance.warFactory.Corrosion; // instance.nonEnemies.Add(explosion); return(corrosion); }
public override void Modify(TargetPoint target, float damage) { WarEntity b = (WarEntity)target.Enemy.Effects.Behaviors.Find(effect => ((WarEntity)effect).name1 == this.GetType().Name + level); if (b != null) { b.age = 0f; } else { Corrosion corrosion = Game.SpawnCorrosion(); corrosion.Initialize(target, this.GetType().Name + level); target.Enemy.Effects.Add(corrosion); } }