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