Exemple #1
0
 void SetupRecursively(Wagon frontWagon, SplineSegment inputSegment)
 {
     front   = frontWagon;
     segment = inputSegment;
     if (back != null)
     {
         back.SetupRecursively(this, segment);
     }
 }
Exemple #2
0
        Wagon GetRootWagon()
        {
            Wagon current = this;

            while (current.front != null)
            {
                current = current.front;
            }
            return(current);
        }
Exemple #3
0
        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>();
 }