Add project files.
This commit is contained in:
31
Assets/Cryville/Crtr/Components/TrackLine.cs
Normal file
31
Assets/Cryville/Crtr/Components/TrackLine.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public class TrackLine : SectionalGameObject {
|
||||
readonly List<Vector3> vertices = new List<Vector3>();
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
}
|
||||
|
||||
protected override void AppendPointInternal(Vector3 p, Quaternion r) {
|
||||
vertices.Add(p);
|
||||
}
|
||||
|
||||
public override void Seal() {
|
||||
var r = GetComponent<LineRenderer>();
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
r.positionCount = vertices.Count;
|
||||
#else
|
||||
r.SetVertexCount(vertices.Count);
|
||||
#endif
|
||||
for (int i = 0; i < vertices.Count; i++) r.SetPosition(i, vertices[i]);
|
||||
}
|
||||
|
||||
public override void Reset() {
|
||||
base.Reset();
|
||||
vertices.Clear();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user