protected override void OnTriggerEnter2D(Collider2D collision) { if (!collision.CompareTag("Player")) { if (collision.gameObject.CompareTag("DynamicParticle")) { managerScript.SetEvaporatedWater(managerScript.GetEvaporatedWater() + 1); DynamicParticle d = collision.gameObject.GetComponent <DynamicParticle>(); if (d.GetIsInPool() && d.evapLeft > 0 && managerScript.GetWaterInPool() >= managerScript.GetWaterNeededInPool()) { managerScript.SetEvaporatedWater(managerScript.GetEvaporatedWater() + 1); d.evapLeft -= 1; } } if (collision.gameObject.CompareTag("DynamicParticleL3")) { Level3DynamicParticleScript d3 = collision.gameObject.GetComponent <Level3DynamicParticleScript>(); if (d3.isInPool && d3.evapLeft > 0 && managerScript.GetWaterInPool() >= managerScript.GetWaterNeededInPool()) { managerScript.SetEvaporatedWater(managerScript.GetEvaporatedWater() + 1); d3.evapLeft -= 1; } } } }
void Start() { pb = transform.GetChild(0).GetComponent <ProgressBar>(); dParticleL3 = transform.parent.gameObject.GetComponent <Level3DynamicParticleScript>(); pb.maxValue = (int)dParticleL3.heatEnergyThreshold; pb.BarValue = (int)dParticleL3.heatEnergyThreshold; }