Exemple #1
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);
        }