/// <summary>
        /// Sets an optional recording to use with the current environment and triggers simulation restart
        /// </summary>
        /// <param name="optionIndex">Index of the recording to use, where 0 means no recording should be used</param>
        public void SetRecordingOptionAndRestartSimulation(int optionIndex)
        {
            if (optionIndex < 0 || optionIndex > CurrentSyntheticRecordingsCount)
            {
                optionIndex = 0;
            }

            // An optionIndex of 0 means no recording is used, so the index into current recordings is optionIndex - 1
            var useRecording = optionIndex > 0;

            CurrentSyntheticRecordingOptionIndex = optionIndex;
            var simulationSettings = SimulationSettings.instance;

            if (useRecording)
            {
                simulationSettings.UseSyntheticRecording = true;
                simulationSettings.SetRecordingForCurrentSyntheticEnvironment(m_CurrentSyntheticRecordings[optionIndex - 1]);
            }
            else
            {
                simulationSettings.UseSyntheticRecording = false;
            }

            RecordingOptionChanged?.Invoke();

            if (useRecording)
            {
                m_QuerySimulationModule.RequestSimulationModeSelection(SimulationModeSelection.TemporalMode);
            }

            m_QuerySimulationModule.RestartSimulationIfNeeded(true);
        }
Ejemplo n.º 2
0
 void RestartSimulationIfNeeded()
 {
     if (SimulationSettings.instance.AutoSyncWithSceneChanges && m_SimulatableBehavioursBlockingSyncing.Count == 0)
     {
         m_QuerySimulationModule.RestartSimulationIfNeeded();
     }
 }
        void OnManualTimeChangeFinalized()
        {
            m_ManualTimeChangeTask = null;
            if (m_CurrentSessionDirector == null || !AutoSyncWithTimeChanges)
            {
                return;
            }

            // When time is manually changed we must rerun the simulation to get it in sync with the current time
            m_QuerySimulationModule.RequestSimulationModeSelection(SimulationModeSelection.TemporalMode);
            m_QuerySimulationModule.RestartSimulationIfNeeded();
        }