1234567891011121314151617181920212223242526272829303132333435 |
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Runtime.Serialization.Formatters.Binary;
- using UnityEngine;
- public static class SaveSystem
- {
- public static void Save(string path, List<Vector3[]> jointsSequence, List<float> recordingTimes)
- {
- BinaryFormatter formatter = new BinaryFormatter();
- FileStream stream = new FileStream(path, FileMode.Create);
- JointsDataSequence data = new JointsDataSequence(jointsSequence, recordingTimes);
- formatter.Serialize(stream, data);
- stream.Close();
- }
- public static JointsDataSequence Load(string path)
- {
- if (File.Exists(path))
- {
- BinaryFormatter formatter = new BinaryFormatter();
- FileStream stream = new FileStream(path, FileMode.Open);
- JointsDataSequence data = formatter.Deserialize(stream) as JointsDataSequence;
- stream.Close();
- return data;
- } else
- {
- Debug.LogError("Save file not found in " + path);
- return null;
- }
- }
- }
|