public void Emit() { if (intensity <= 0.0f) { onParticles.Stop(); pointLight.SetActive(false); if (laserRay != null) { /*foreach (Transform child in laserRay.transform) * Destroy(child.gameObject);*/ Destroy(laserRay.gameObject); laserRay = null; } return; } onParticles.Play(); pointLight.SetActive(true); if (laserRay == null) { laserRay = LaserManager.Instance.CastLaser(transform.position, transform.right, transform); } foreach (Transform child in laserRay.transform) { Destroy(child.gameObject); } laserRay.Cast(transform.position, transform.right, laserRay.transform); }
public LaserRay CastLaser(Vector3 from, Vector3 direction) { LaserRay laser = Instantiate(laserRayPrefab, laserParent); laser.Cast(from, direction, laserParent); return(laser); }
public LaserRay CastLaser(Vector3 from, Vector3 direction, Transform parent) { if (parent == null) { parent = laserParent; } LaserRay laser = Instantiate(laserRayPrefab, parent); laser.Cast(from, direction, laser.transform); return(laser); }