|
@ -5,7 +5,8 @@ public class MagnetLaser : MonoBehaviour { |
|
|
|
|
|
|
|
|
private LineRenderer lr; |
|
|
private LineRenderer lr; |
|
|
public GameObject player; |
|
|
public GameObject player; |
|
|
public GameObject rodstart; |
|
|
|
|
|
|
|
|
public GameObject rodStart; |
|
|
|
|
|
public GameObject magnetSparkles; |
|
|
public int segments; |
|
|
public int segments; |
|
|
public float randomSize; |
|
|
public float randomSize; |
|
|
private magnetGun gun; |
|
|
private magnetGun gun; |
|
@ -25,9 +26,13 @@ public class MagnetLaser : MonoBehaviour { |
|
|
void Update () { |
|
|
void Update () { |
|
|
|
|
|
|
|
|
if (gun.GravityTarget != null) { |
|
|
if (gun.GravityTarget != null) { |
|
|
|
|
|
if (magnetSparkles != null) |
|
|
|
|
|
magnetSparkles.SetActive(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); |
|
|
lr.SetPosition (segments,gun.GravityTarget.transform.position); |
|
|
lr.SetPosition (segments,gun.GravityTarget.transform.position); |
|
|
|
|
|
|
|
|
Vector3 normalizedV =(gun.GravityTarget.transform.position - player.transform.position); |
|
|
Vector3 normalizedV =(gun.GravityTarget.transform.position - player.transform.position); |
|
@ -48,6 +53,8 @@ public class MagnetLaser : MonoBehaviour { |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
lr.enabled = false; |
|
|
lr.enabled = false; |
|
|
|
|
|
if (magnetSparkles != null) |
|
|
|
|
|
magnetSparkles.SetActive(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|