Made lines set width
This commit is contained in:
@@ -42,12 +42,25 @@ public class GlobalOrbitalPositionManager : MonoBehaviour
|
||||
|
||||
public static float GetDistanceOf(Int64 rowID) => s_Instance.m_Distances[rowID];
|
||||
|
||||
Vector3[] m_PrecalculatedPositions;
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] private static void OnApplicationStart()
|
||||
{
|
||||
GameObject manager = new("GLOBAL ORBITAL MANAGER");
|
||||
DontDestroyOnLoad(manager);
|
||||
|
||||
s_Instance = manager.AddComponent<GlobalOrbitalPositionManager>();
|
||||
s_Instance.m_PrecalculatedPositions = new Vector3[365];
|
||||
|
||||
for (int i = 0; i < 365; i++)
|
||||
{
|
||||
s_Instance.m_PrecalculatedPositions[i] = new Vector3
|
||||
(
|
||||
x: Mathf.Cos(Mathf.Deg2Rad * i),
|
||||
y: Mathf.Sin(Mathf.Deg2Rad * i),
|
||||
z: 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
@@ -61,6 +74,16 @@ public class GlobalOrbitalPositionManager : MonoBehaviour
|
||||
ring.ID = m_LastGeneratedRing + 1;
|
||||
m_Rings.Add(ring);
|
||||
|
||||
LineRenderer renderer = newRing.GetComponentInChildren<LineRenderer>();
|
||||
renderer.positionCount = 365;
|
||||
renderer.startWidth = 0.1f;
|
||||
renderer.endWidth = 0.1f;
|
||||
|
||||
renderer.material = new(Shader.Find("Sprites/Default"));
|
||||
|
||||
renderer.startColor = Color.white;
|
||||
renderer.endColor = Color.white;
|
||||
|
||||
m_LastGeneratedRing = ring.ID;
|
||||
|
||||
m_TimeOfLastRingSpawn = Time.time;
|
||||
@@ -75,6 +98,12 @@ public class GlobalOrbitalPositionManager : MonoBehaviour
|
||||
float diff = Time.deltaTime * GlobalOrbitalSettings.DistanceSpeed;
|
||||
ring.transform.localScale -= new Vector3(diff, diff, 0f);
|
||||
|
||||
LineRenderer renderer = ring.GetComponentInChildren<LineRenderer>();
|
||||
for (int vert = 0; vert < 365; vert++)
|
||||
{
|
||||
renderer.SetPosition(vert, m_PrecalculatedPositions[vert] * ring.transform.localScale.x);
|
||||
}
|
||||
|
||||
if (ring.transform.localScale.x < 0)
|
||||
{
|
||||
toRemove.Add(ring);
|
||||
|
||||
Reference in New Issue
Block a user