private void OnTriggerEnter(Collider other) { PyrolysisPlastic plastic = other.GetComponent <PyrolysisPlastic>(); if (plastic != null && plastic.AmountOfPlastic >= 1) { machine.AddPlastic(); Destroy(plastic.gameObject, destroyTimeout); return; } MoleculePack molecule = other.GetComponent <MoleculePack>(); if (molecule != null && molecule.MoleculeAbbreviation == "CH4") { machine.AddMethane(); Destroy(molecule.gameObject, destroyTimeout); return; } }
private void OnTriggerEnter(Collider other) { MoleculePack molecule = other.GetComponent <MoleculePack>(); if (molecule != null && molecule.MoleculeAbbreviation == correct.MoleculeAbbreviation) { foreach (Renderer gameObject in dirtyObjects) { StartCoroutine(FadeMaterial(gameObject.material)); } foreach (ParticleSystem particleSystem in dirtyParticles) { particleSystem.Stop(); } foreach (Renderer water in dirtyWater) { water.material.SetTexture("_MainTex", cleanWater); } loader.LoadScene(scene, timeout); } }