r2mods/ilspy_dump/ror2_csproj/ScaleLineRenderer.cs

28 lines
498 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
public class ScaleLineRenderer : MonoBehaviour
{
private LineRenderer line;
public float scaleSize = 1f;
public Vector3[] positions;
private void Start()
{
line = GetComponent<LineRenderer>();
SetScale();
}
private void Update()
{
}
private void SetScale()
{
line.SetPosition(0, positions[0]);
line.SetPosition(1, positions[1]);
line.material.SetTextureScale("_MainTex", new Vector2(Vector3.Distance(positions[0], positions[1]) * scaleSize, 1f));
}
}