} // TrackData(setFilename, setTrackPoints, setWidthHelpers) /// <summary> /// Load track data /// </summary> /// <param name="setFilename">Set filename</param> public static TrackData Load(string setFilename) { // Load track data StreamReader file = new StreamReader(FileHelper.LoadGameContentFile( Directory + "\\" + setFilename + "." + Extension)); // Load everything into this class with help of the XmlSerializer. TrackData loadedTrack = (TrackData) new XmlSerializer(typeof(TrackData)). Deserialize(file.BaseStream); // Close the file file.Close(); // Return loaded file return(loadedTrack); } // TrackData(setFilename)
} // TestRenderingTrack() //*/ #endregion #region Test rendering TrackData /// <summary> /// Test rendering TrackData /// </summary> //[Test] public static void TestRenderingColladaTrack() { TrackLine track = new TrackLine( TrackData.Load("TrackSimple"), null); TestGame.Start( delegate { SpeedyRacerManager.Player.SetCarPosition(track.points[0].pos, new Vector3(0, 1, 0), new Vector3(0, 0, 1)); ShowGroundGrid(); ShowTrackLines(track); //always show: if (TestGame.Keyboard.IsKeyDown(Keys.LShiftKey)) ShowUpVectors(track); }); } // TestRenderingTrack()
/// <summary> /// Create road helper position /// </summary> /// <param name="setStartNum">Set start number</param> /// <param name="setEndNum">Set end number</param> public RoadHelperPosition(TrackData.RoadHelper.HelperType setType, int setStartNum, int setEndNum) { type = setType; startNum = setStartNum; endNum = setEndNum; }
/// <summary> /// Load /// </summary> /// <param name="colladaTrack">Collada track</param> /// <param name="landscape">Landscape</param> protected void Load(TrackData colladaTrack, Landscape landscape) { Load(colladaTrack.TrackPoints.ToArray(), colladaTrack.WidthHelpers, colladaTrack.RoadHelpers, colladaTrack.NeutralsObjects, landscape); }
/// <summary> /// Create track line /// </summary> /// <param name="inputPointsFromColladaTrack"> /// Input points from collada track</param> public TrackLine(TrackData inputPointsFromColladaTrack, Landscape landscape) : this(inputPointsFromColladaTrack.TrackPoints.ToArray(), inputPointsFromColladaTrack.WidthHelpers, inputPointsFromColladaTrack.RoadHelpers, inputPointsFromColladaTrack.NeutralsObjects, landscape) { }