예제 #1
0
        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);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
 public UserTransformRecordEnvironment(UserTransformableRecordable target)
 {
     this.target = target;
     recording   = new UserTransformableRecording();
     ghosts      = new List <UserTransformableGhost>();
 }