public override void GrabUpdate() { base.GrabUpdate(); ParticleMan.Emit(1, 2, Nozzle.position, Nozzle.forward); for (int i = 0; i < 24; i++) { SudsMaster.TryKillSuds(new Ray(Nozzle.position, Nozzle.forward + new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f)) * spread)); } }
public static void TryKillSuds(Ray r) { LayerMask mask = LayerMask.GetMask("Rinseable"); RaycastHit rch = new RaycastHit(); if (Physics.Raycast(r, out rch, 10f)) { SudsMaster sm = rch.transform.GetComponent <SudsMaster>(); if (sm != null) { if (!sm.IsDying) { sm.Die(); } } } }