示例#1
0
        public static Track Parse(params string[] data)
        {
            Track track = null;
              switch (data[0]) {
            case "TrackLine": track = new TrackLine(float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
              break;
            case "TrackTurn": track = new TrackTurn(float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
              break;
            case "TrackArcLeft": track = new TrackArcLeft(float.Parse(data[2]), float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
              break;
            case "TrackArcRight": track = new TrackArcRight(float.Parse(data[2]), float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
              break;
              }

              return track;
        }
示例#2
0
        public static Track Parse(params string[] data)
        {
            Track track = null;

            switch (data[0])
            {
            case "TrackLine": track = new TrackLine(float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
                break;

            case "TrackTurn": track = new TrackTurn(float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
                break;

            case "TrackArcLeft": track = new TrackArcLeft(float.Parse(data[2]), float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
                break;

            case "TrackArcRight": track = new TrackArcRight(float.Parse(data[2]), float.Parse(data[1]), Track.DefaultMaxSpeed, Track.DefaultAcceleration);
                break;
            }

            return(track);
        }