|
|
@ -9,13 +9,14 @@ public class MagnetLaser : MonoBehaviour { |
|
|
|
public int segments; |
|
|
|
public float randomSize; |
|
|
|
private magnetGun gun; |
|
|
|
private ParticleSystem[] sparks; |
|
|
|
|
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
void Start () { |
|
|
|
gun = player.GetComponent<magnetGun> (); |
|
|
|
lr = GetComponent<LineRenderer> (); |
|
|
|
|
|
|
|
sparks = gun.GetComponentsInChildren<ParticleSystem>(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -25,6 +26,10 @@ public class MagnetLaser : MonoBehaviour { |
|
|
|
void Update () { |
|
|
|
|
|
|
|
if (gun.GravityTarget != null) { |
|
|
|
|
|
|
|
sparks[0].enableEmission = true; |
|
|
|
sparks[1].enableEmission = true; |
|
|
|
|
|
|
|
lr.enabled = true; |
|
|
|
lr.SetVertexCount(segments+1); |
|
|
|
lr.SetPosition(0, rodstart.transform.position); |
|
|
@ -48,6 +53,8 @@ public class MagnetLaser : MonoBehaviour { |
|
|
|
|
|
|
|
} else { |
|
|
|
lr.enabled = false; |
|
|
|
sparks[0].enableEmission = false; |
|
|
|
sparks[1].enableEmission = false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|