|
|
|
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using Randomization.ParameterBehaviours; |
|
|
|
using Unity.Simulation; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.Perception.GroundTruth; |
|
|
|
|
|
|
|
|
|
|
static ScenarioBase s_ActiveScenario; |
|
|
|
bool m_SkipFrame = true; |
|
|
|
bool m_FirstScenarioFrame = true; |
|
|
|
bool m_WaitingForFinalUploads = false; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// If true, this scenario will quit the Unity application when it's finished executing
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// Wait for any final uploads before exiting quitting
|
|
|
|
if (m_WaitingForFinalUploads) |
|
|
|
{ |
|
|
|
if (!Manager.FinalUploadsDone) |
|
|
|
return; |
|
|
|
|
|
|
|
if (quitOnComplete) |
|
|
|
#if UNITY_EDITOR
|
|
|
|
UnityEditor.EditorApplication.ExitPlaymode(); |
|
|
|
#else
|
|
|
|
Application.Quit(); |
|
|
|
#endif
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// Iterate Scenario
|
|
|
|
if (m_FirstScenarioFrame) |
|
|
|
{ |
|
|
|
|
|
|
{ |
|
|
|
foreach (var behaviour in ParameterBehaviour.behaviours) |
|
|
|
behaviour.OnScenarioComplete(); |
|
|
|
Manager.Instance.Shutdown(); |
|
|
|
if (quitOnComplete) |
|
|
|
#if UNITY_EDITOR
|
|
|
|
UnityEditor.EditorApplication.isPlaying = false; |
|
|
|
#else
|
|
|
|
Application.Quit(); |
|
|
|
#endif
|
|
|
|
m_WaitingForFinalUploads = true; |
|
|
|
return; |
|
|
|
|
|
|
|
if (currentIterationFrame == 0) |
|
|
|
{ |
|
|
|
DatasetCapture.StartNewSequence(); |
|
|
|