public static UserTransformableRecording Load(string filename) { UserTransformableRecording newRecording = new UserTransformableRecording(); try { FileStream file = File.OpenRead(Path.Combine(Application.persistentDataPath, filename)); BinaryReader reader = new BinaryReader(file); int nKeyframes = reader.ReadInt32(); for (int i = 0; i < nKeyframes; i++) { newRecording.AddKeyframe(new UserTransformKeyframe(ref reader)); } if (reader.ReadUInt32() != 0xffffffff) { throw new Exception("Invalid save file"); } OneButtonAlert.Create("Loaded recording successfully."); } catch (Exception e) { OneButtonAlert.Create("Failed to load saved recording."); } return(newRecording); }
public UserTransformRecordEnvironment(UserTransformableRecordable target, string filename) { this.target = target; recording = UserTransformableRecording.Load(filename); ghosts = new List <UserTransformableGhost>(); for (int i = 0; i < recording.keyframes.Count; i++) { ghosts.Add(recording.keyframes[i].CreateGhost(target)); IncorporateGhost(i); } }
public UserTransformRecordEnvironment(UserTransformableRecordable target) { this.target = target; recording = new UserTransformableRecording(); ghosts = new List <UserTransformableGhost>(); }