コード例 #1
0
        // Methods
        public IEnumerator Start()
        {
            // Create a record scene for the record object
            ReplayScene recordScene = new ReplayScene(recordObject);

            // Start recording the single object
            ReplayHandle recordHandle = ReplayManager.BeginRecording(null, recordScene);

            // Allow some data to be recorded for 1 second
            yield return(new WaitForSeconds(1f));

            // Stop recording
            ReplayManager.StopRecording(ref recordHandle);


            // Clone the identity which allows the replayObject to be replayed as the recordObject
            ReplayObject.CloneReplayObjectIdentity(recordObject, replayObject);


            // Create a playback scene for the replay object
            ReplayScene playbackScene = new ReplayScene(replayObject);

            // Start playback
            ReplayManager.BeginPlayback(null, playbackScene);
        }
コード例 #2
0
        // Methods
        public IEnumerator Start()
        {
            // Usually you should register replay prefabs in editor via the global settings but it can also be done via code if required
            UltimateReplay.Settings.prefabs.RegisterReplayablePrefab(instanitatePrefab);


            // Start recording - Note that we need to enable 'allowEmptyScene' if there are no replay objects in the scene initially
            ReplayHandle recordHandle = ReplayManager.BeginRecording(null, null, true, true);

            // Wait for some time to pass
            yield return(new WaitForSeconds(1f));

            // Spawn a dynamic replay object
            ReplayObject obj = Instantiate(instanitatePrefab);

            // Add the object to all recording scenes - This is a required step otherwise the object will not be recorded
            ReplayManager.AddReplayObjectToRecordScenes(obj);

            // Wait for some time to pass now that the object has been spawned
            yield return(new WaitForSeconds(1));

            // End recording
            // The resulting replay will have 1 second of nothing and then the dynamic object will be re-instantiated by the replay system
            ReplayManager.StopRecording(ref recordHandle);
        }
コード例 #3
0
        // Methods
        public void Start()
        {
            // Create a memory storage target to store the replay
            ReplayStorageTarget storage = new ReplayMemoryTarget();

            // Begin recording to the specified storage target.
            // We should store the returned replay handle as all other replay operations will expect this value as a parameter to identify the recording
            // By default, all replay objects in the active scene will be recorded.
            recordHandle = ReplayManager.BeginRecording(storage);
        }
コード例 #4
0
        private IEnumerator RestartKillcamRecording()
        {
            // Wait a frame
            yield return(null);

            // Start recording again
            killcamStorage.Clear();

            killcamHandle = ReplayManager.BeginRecording(killcamStorage);
        }
コード例 #5
0
        // Methods
        public override void Awake()
        {
            base.Awake();

            // Create a rolling memory buffer of 10 seconds
            killcamStorage = ReplayMemoryTarget.CreateTimeLimitedRolling(recordKillcamSeconds);

            // Start recording
            killcamHandle = ReplayManager.BeginRecording(killcamStorage);
        }
コード例 #6
0
        // Methods
        public IEnumerator Start()
        {
            // Record as normal
            ReplayHandle handle = ReplayManager.BeginRecording(new ReplayMemoryTarget());

            // Allow recording to run for 1 second
            yield return(new WaitForSeconds(1f));

            // Stop recording
            // We need to pass the handle to the recording as a reference which will cause the handle to become invalid
            ReplayManager.StopRecording(ref handle);
        }
コード例 #7
0
        // Methods
        public IEnumerator Start()
        {
            // Record as normal
            ReplayHandle handle = ReplayManager.BeginRecording(new ReplayMemoryTarget());

            // Allow recording to run for 1 second
            yield return(new WaitForSeconds(1f));

            // Pause recording
            // This will supend recording and we can resume at a later date so long as we have the replay handle object
            ReplayManager.PauseRecording(handle);
        }
コード例 #8
0
        public void ResetKillcam()
        {
            // Stop recording
            if (ReplayManager.IsRecording(killcamHandle) == true)
            {
                ReplayManager.StopRecording(ref killcamHandle);
            }

            killcamStorage.Clear();

            killcamHandle = ReplayManager.BeginRecording(killcamStorage);
        }
コード例 #9
0
        // Methods
        public IEnumerator Start()
        {
            // Create a replay file target for the specified file path
            ReplayFileTarget recordFile = ReplayFileTarget.CreateReplayFile("C:/ReplayFiles/Example.replay");

            // Start recording to the file
            ReplayHandle recordHandle = ReplayManager.BeginRecording(recordFile);

            // Allow some data to be recorded for 1 second
            yield return(new WaitForSeconds(1f));

            // Stop recording - This will finalize the replay file, commit any buffered data and dispose of any open file streams.
            ReplayManager.StopRecording(ref recordHandle);
        }
コード例 #10
0
    /// <summary>
    /// make a new recording
    /// </summary>
    /// <param name="name"></param>
    public void createRecording(string name)
    {
        ReplayFileTarget target = ReplayManager.Target as ReplayFileTarget;

        // Set the location/name of the replay file to load
        target.FileOutputName = name + ".replay";
        Debug.Log(name);
        //add it to the dictionary and save to a file.
        GetComponent <micRecorder>().StartRecording(name);
        RecordingDictionaryClass.addRecording(name, name + ".replay", name + ".wav");
        RecordingDictionaryClass.SaveDictionary();

        ReplayManager.BeginRecording();
        Debug.Log("Recording");
    }
コード例 #11
0
        public IEnumerator Start()
        {
            // Create a stream object of some form to hold the data. This could be any stream that supports writing, seeking and getting Position.
            MemoryStream stream = new MemoryStream();


            // Create a replay stream target for the specified stream object
            ReplayStreamTarget recordStream = ReplayStreamTarget.CreateReplayStream(stream);

            // Start recording to the stream
            ReplayHandle recordHandle = ReplayManager.BeginRecording(recordStream);

            // Allow some data to be recorded for 1 second
            yield return(new WaitForSeconds(1f));

            // Stop recording - This will finalize the replay file, commit any buffered data and dispose of any open file streams.
            ReplayManager.StopRecording(ref recordHandle);
        }
コード例 #12
0
        // Methods
        public IEnumerator Start()
        {
            for (int i = 0; i < 5; i++)
            {
                ReplayMemoryTarget storage = new ReplayMemoryTarget();

                // Record some gameplay
                ReplayHandle handle = ReplayManager.BeginRecording(storage);

                // Wait for some data to be recorded
                yield return(new WaitForSeconds(3));

                // End the recording
                ReplayManager.StopRecording(ref handle);

                // Add storage
                highlightsStorage.Add(storage);
            }
        }
コード例 #13
0
        // Methods
        public IEnumerator Start()
        {
            ReplayMemoryTarget storage = new ReplayMemoryTarget();

            // Record as normal
            ReplayHandle handle = ReplayManager.BeginRecording(storage);

            // Allow recording to run for 1 second
            yield return(new WaitForSeconds(1f));

            // Stop recording
            // We need to pass the handle to the recording as a reference which will cause the handle to become invalid
            ReplayManager.StopRecording(ref handle);


            // Begin playback of the recording that we captured in the storage target
            // Again this method will return a replay handle that is required for many other playback operations
            playbackHandle = ReplayManager.BeginPlayback(storage);
        }
コード例 #14
0
        public void OnTriggerEnter(Collider other)
        {
            Debug.LogWarning("Trigger");

            // Stop replaying
            if (ReplayManager.IsReplaying(playbackHandle) == true)
            {
                ReplayManager.StopPlayback(ref playbackHandle);
            }

            // Stop recording
            if (ReplayManager.IsRecording(recordHandle) == true)
            {
                // Stop recording
                ReplayManager.StopRecording(ref recordHandle);

                playbackStorage = recordStorage;
                recordStorage   = new ReplayMemoryTarget();

                Debug.Log("Recording Length: " + playbackStorage.Duration);

                // Enable the ghost car
                ghostCar.gameObject.SetActive(true);

                // Clone identities - This allows the ghost car to be replayed as the player car
                ReplayObject.CloneReplayObjectIdentity(playerCar, ghostCar);

                // Start replaying
                playbackHandle = ReplayManager.BeginPlayback(playbackStorage, playbackScene);

                // Add end playback listener
                ReplayManager.AddPlaybackEndListener(playbackHandle, OnGhostVehiclePlaybackComplete);
            }

            // Start recording
            recordHandle = ReplayManager.BeginRecording(recordStorage, recordScene);
        }
コード例 #15
0
        public IEnumerator StartAlternative()
        {
            // Create a replay scene from the active Unity scene
            ReplayScene recordScene = ReplayScene.FromCurrentScene();

            // Start recording
            ReplayHandle recordHandle = ReplayManager.BeginRecording(null, recordScene);

            // Wait for some time to pass
            yield return(new WaitForSeconds(1f));

            // Spawn a dynamic replay object
            ReplayObject obj = Instantiate(instanitatePrefab);

            // Add the object to the record scene only - This is a required step otherwise the object will not be recorded
            recordScene.AddReplayObject(obj);

            // Wait for some time to pass now that the object has been spawned
            yield return(new WaitForSeconds(1));

            // End recording
            // The resulting replay will have 1 second of nothing and then the dynamic object will be re-instantiated by the replay system
            ReplayManager.StopRecording(ref recordHandle);
        }
コード例 #16
0
 public void StartRecording()
 {
     Debug.Log("--- Start Recording ---");
     ReplayManager.BeginRecording(true);
 }