public FlexibleRailPiece(RailPieceDefinition definition, Vector3[] controlPoints) : base(definition, true, true)
 {
     if (controlPoints != null)
     {
         Debug.Assert(controlPoints.Length == 4);
         Debug.Assert(RailSegments.Length == 1);
         UpdateRailSegment(0, controlPoints);
     }
 }
Beispiel #2
0
        protected RailPiece(RailPieceDefinition definition, bool copyCurves, bool copyGeometry)
        {
            ID         = FirstUnusedID++;
            Definition = definition;
            GameObject = new GameObject("Rail piece " + ID);

            // Copy rail segments. Cannot share segments of definition,
            // because of next and previous fields in rail segments that must
            // be different for each rail piece instance.
            RailSegments = new RailSegment[definition.RailSegments.Length];
            for (int k = 0; k < RailSegments.Length; k++)
            {
                RailSegments[k] = new RailSegment(definition.RailSegments[k], this, copyCurves);
            }

            GameObject = (GameObject)Object.Instantiate(definition.GetPrefab());
            if (copyGeometry)
            {
            }
        }