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