Пример #1
0
 public TrackSection(STFReader stf)
 {
     stf.MustMatch("(");
     SectionIndex = stf.ReadUInt(null);
     stf.ParseBlock(new STFReader.TokenProcessor[] {
         new STFReader.TokenProcessor("sectionsize", () => { SectionSize = new SectionSize(stf); }),
         new STFReader.TokenProcessor("sectioncurve", () => { SectionCurve = new SectionCurve(stf); }),
     });
     //if( SectionSize == null )
     //	throw( new STFError( stf, "Missing SectionSize" ) );
     //  note- default TSECTION.DAT does have some missing sections
 }
Пример #2
0
        public RouteTrackSection(STFReader stf)
        {
            stf.MustMatch("(");
            stf.MustMatch("SectionCurve");
            stf.SkipBlock();
            SectionIndex = stf.ReadUInt(null);
            SectionSize  = new SectionSize();
            float a = stf.ReadFloat(STFReader.UNITS.Distance, null);
            float b = stf.ReadFloat(STFReader.UNITS.None, null);

            if (b == 0)
            // Its straight
            {
                SectionSize.Length = a;
            }
            else
            // its curved
            {
                SectionCurve        = new SectionCurve();
                SectionCurve.Radius = b;
                SectionCurve.Angle  = (float)MathHelper.ToDegrees(a);
            }
            stf.SkipRestOfBlock();
        }