void SetupRecursively(Wagon frontWagon, SplineSegment inputSegment) { front = frontWagon; segment = inputSegment; if (back != null) { back.SetupRecursively(this, segment); } }
Wagon GetRootWagon() { Wagon current = this; while (current.front != null) { current = current.front; } return(current); }
void ResetSegments() { Wagon current = back; bool same = true; while (current != null) { if (current.segment != segment) { same = false; break; } current = current.back; } //if all wagons are on the same segment, remove the segment entrance so that they can loop if (same) { segment.start = -1; } }
private void Awake() { wagon = GetComponent <Wagon>(); }