Beispiel #1
0
        public void TrackDataSaveAndLoad()
        {
            // Arrange
            TrackData data = new TrackData();
            TrackData loadedData;

            data.m_scale         = Vector2.one;
            data.m_featurePoints = new Vector3 [] { Vector3.zero };
            string filename = "TestTrack";

            // Act
            Debug.Log("Before:");
            Debug.Log(data.ToString());
            data.SaveAsJson(filename);
            loadedData = SaveExtension.LoadTrackData(filename);

            // Assert
            Debug.Log("After:");
            Debug.Log(data.ToString());

            Assert.That(data.m_scale.Equals(loadedData.m_scale));
            Assert.That(data.m_precision.Equals(loadedData.m_precision));
            Assert.That(data.m_closed.Equals(loadedData.m_closed));
            Assert.That(data.m_featurePoints[0].Equals(loadedData.m_featurePoints [0]));
        }
    private void Load(string fileName)
    {
        if (!Active)
        {
            return;
        }
        Debug.Log("BuildLoadSTate: Load fileName");

        // try load track data
        m_buildSM.CurrentTrackData = SaveExtension.LoadTrackData(fileName);
        m_trackBuilder.InstantiateFeaturePoints(ref m_buildSM.CurrentTrackData.m_featurePoints);
    }