private void UpdateLineTarget() { try { if (HasLineSpawned && closestCollectable == null) { if (LR.GetComponent <LineRenderer>().enabled) { LR.GetComponent <LineRenderer>().enabled = false; } return; } if (closestCollectable != null) { if (!LR.GetComponent <LineRenderer>().enabled) { LR.GetComponent <LineRenderer>().enabled = true; } Vector3 position = new Vector3(player.transform.position.x, player.transform.position.y - 1f, player.transform.position.z); LR.GetComponent <LineRenderer>().SetPosition(0, position); LR.GetComponent <LineRenderer>().SetPosition(1, closestCollectable.transform.position); } } catch (Exception) { } }
private void ToggleLineVisibility() { if (LR != null) { if (isLineHidden) { LR.GetComponent <LineRenderer>().enabled = false; LR.GetComponent <LineRenderer>().startWidth = 0f; LR.GetComponent <LineRenderer>().endWidth = 0f; MelonModLogger.Log("Line is now invisible!"); isLineHidden = false; } else { LR.GetComponent <LineRenderer>().enabled = true; LR.GetComponent <LineRenderer>().startWidth = lineWidth; LR.GetComponent <LineRenderer>().endWidth = lineWidth; MelonModLogger.Log("Line is now visible!"); isLineHidden = true; } } }