/* * public Tank(string n, int rt, int cp, bool act) * { * name = n; * rate = rt; * capacity = cp; * isActive = act; * } */ public Tank(Chemical.Compound s, int rt, int cp, bool act) { substance = s; rate = rt; capacity = cp; isActive = act; }
public void Vent() { for (int i = 0; i < allTanks.Length; i++) { allTanks[i].capacity = 0; // allTanks[i].name = ""; allTanks[i].substance = null; } // chemToShootName = ""; chemToShoot = null; shootEffect = null; Chemical.Compound[] components = this.gameObject.GetComponents <Chemical.Compound> (); for (int i = 0; i < components.Length; i++) { Destroy(components[i]); } //audio //gunAudio.PlayOneShot(ACvent); audios[12].Play(); }
public void selectTank(Tank selectTank) { for (int i = 0; i < allTanks.Length; i++) { Tank tank = allTanks[i]; if (tank != selectTank) { tank.isActive = false; } else { tank.isActive = !tank.isActive; } } Chemical.Compound[] components = this.gameObject.GetComponents <Chemical.Compound> (); for (int i = 0; i < components.Length; i++) { Destroy(components[i]); } // if (selectTank.name != "") if (selectTank.substance != null) { string chemToShootName = selectTank.substance.CompoundName; chemToShoot = this.gameObject.AddComponent(chemToShootName) as Chemical.Compound; chemToShoot.init(); shootEffect = GameObject.Find("ShootGun").GetComponent <GunParticleSwitcher>().setParticleSystem(chemToShoot.state, chemToShoot.color); } else { // chemToShootName = ""; chemToShoot = null; shootEffect = null; } }
public Tank(Chemical.Compound s, int rt) : this(s, rt, 0, false) { }