void Start() { FloatingTextController.Initalize(); sculpturePrefab = Resources.Load <GameObject>("Prefabs/Sculpture/SculpturePrefabs"); sculptMaterialPrefab = Resources.Load <GameObject>("Prefabs/Sculpture/Materials"); //데이터 Load if (System.IO.File.Exists(DataSaver.filePath)) { graver = DataSaver.LoadData <Graver>(DataSaver.filePath); RefreshDisplay(); } else { graver = new Graver(); graver.CurrentSculpture = Inventory.database.FetchSculptureItemById(0); graver.CurrentSculptMaterial = Inventory.database.FetchMaterialItemById(0); Directory.CreateDirectory(Application.persistentDataPath + "/Data"); } graver.CurrentSculpture.sprite = Inventory.database.FetchSculptureItemById(graver.CurrentSculpture.Id).sprite; animator = sprite.GetComponent <Animator>(); Invoke("WaitCommand", 1f); StartCoroutine(IncreaseHealth()); StartCoroutine(UpdateProgressBar()); }
public void RecordTest() { var recorder = new Graver <fbInheritanceLevel_5, PlainfbInheritanceLevel_5>(connector.MAIN.InheritanceRw); recorder.StartRecording(); for (int i = 0; i < 254; i++) { connector.MAIN.InheritanceRw.level_0.BYTE_val.Cyclic = (byte)i; connector.MAIN.InheritanceRw.level_1.BYTE_val.Cyclic = (byte)i; connector.MAIN.InheritanceRw.level_2.WORD_val.Cyclic = (ushort)(i * 2); connector.MAIN.InheritanceRw.level_2.STRING_val.Cyclic = (i * 180).ToString(); connector.MAIN.InheritanceRw.level_3.WSTRING_val.Cyclic = (i * 258).ToString(); connector.MAIN.InheritanceRw.Write(); recorder.RecordFrame(); } recorder.Stop(RecordingFile); Assert.IsTrue(File.Exists(RecordingFile), "Recroding file not created."); }
public void SquashTest() { var recorder = new Graver <stAllTypes, PlainstAllTypes>(connector.MAIN.InheritanceRw.level_0); recorder.StartRecording(); for (int i = 0; i < 254; i++) { if (i % 10 == 0) { connector.MAIN.InheritanceRw.level_0.STRING_val.Cyclic = i.ToString(); connector.MAIN.InheritanceRw.level_0.Write(); } recorder.RecordFrame(); } recorder.Stop(SquashTestFile); Assert.IsTrue(File.Exists(SquashTestFile), "Squash test recording file not created."); var player = new Player <stAllTypes, PlainstAllTypes>(connector.MAIN.InheritanceRw.level_0); player.StartPlay(SquashTestFile); foreach (var item in recorder.Recording.Frames) { Console.WriteLine($"{item.Stamp} : {item.Object.STRING_val}"); } Assert.AreEqual(26, player.Recording.Frames.Count()); Assert.AreEqual(9, player.Recording.Frames[0].Stamp); Assert.AreEqual("0", player.Recording.Frames[0].Object.STRING_val); Assert.AreEqual(19, player.Recording.Frames[1].Stamp); Assert.AreEqual("10", player.Recording.Frames[1].Object.STRING_val); Assert.AreEqual(253, player.Recording.Frames[25].Stamp); Assert.AreEqual("250", player.Recording.Frames[25].Object.STRING_val); }