Skip to content

Commit

Permalink
Update TractorBeam.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewGB authored Jul 23, 2020
1 parent 9ad1d0b commit 5160c15
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class TractorBeam : MonoBehaviour
protected float energyPickupSpeed = 61.0f; // Disabled for now D: (60*FixedDeltatime = 10) Energy pickup rate scale for future hard/easy gamemodes and AI balancing only.
public bool initialized;
private bool energyEnabled = true;
private GameObject tractorBeamPrefab;

public void SetEnergyEnabled(bool val) {
energyEnabled = val;
Expand All @@ -36,7 +37,7 @@ public void BuildTractor() {
targetGlow.gameObject.SetActive(false);

GameObject childObject = new GameObject();
// childObject.transform.SetParent(transform, false);
//childObject.transform.SetParent(transform, false); Unity ignores sorting layers if uncommented
lineRenderer = childObject.AddComponent<LineRenderer>();
lineRenderer.material = tractorMaterial;
lineRenderer.startWidth = 0.1F;
Expand All @@ -46,6 +47,7 @@ public void BuildTractor() {
lineRenderer.sortingOrder = 1;
lineRenderer.sortingLayerName = "Projectiles";
childObject.name = "TractorBeam";
tractorBeamPrefab = childObject;
initialized = true;
}
private void Update() {
Expand Down Expand Up @@ -156,8 +158,10 @@ protected void OnDestroy()
{
if(coreGlow)
Destroy(coreGlow.gameObject);
if (targetGlow)
if(targetGlow)
Destroy(targetGlow.gameObject);
if(tractorBeamPrefab)
Destroy(tractorBeamPrefab);
}

bool forcedTargetHadDraggable = false;
Expand Down

0 comments on commit 5160c15

Please sign in to comment.