浏览代码

converted scenario update coroutine to regular update method

/usim-randomization
Steven Leal 4 年前
当前提交
b35616bf
共有 1 个文件被更改,包括 27 次插入26 次删除
  1. 53
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs

53
com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs


void OnDisable()
{
s_ActiveScenario = null;
StopCoroutine(UpdateLoop());
}
IEnumerator Start()

foreach (var config in ParameterConfiguration.configurations)
config.ValidateParameters();
OnInitialize();
StartCoroutine(UpdateLoop());
IEnumerator UpdateLoop()
void Update()
while (!isScenarioComplete)
if (isScenarioComplete)
{
OnComplete();
DatasetCapture.ResetSimulation();
if (quitOnComplete)
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
return;
}
if (isIterationComplete)
{
currentIteration++;
currentIterationFrame = 0;
OnIterationTeardown();
}
if (currentIterationFrame == 0)
{
DatasetCapture.StartNewSequence();
foreach (var config in ParameterConfiguration.configurations)

OnIterationSetup();
while (!isIterationComplete)
{
foreach (var config in ParameterConfiguration.configurations)
config.ApplyParameters(framesSinceInitialization, ParameterApplicationFrequency.EveryFrame);
OnFrameStart();
yield return null;
currentIterationFrame++;
framesSinceInitialization++;
}
currentIteration++;
currentIterationFrame = 0;
OnIterationTeardown();
OnComplete();
DatasetCapture.ResetSimulation();
if (quitOnComplete)
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
foreach (var config in ParameterConfiguration.configurations)
config.ApplyParameters(framesSinceInitialization, ParameterApplicationFrequency.EveryFrame);
OnFrameStart();
currentIterationFrame++;
framesSinceInitialization++;
}
}
}
正在加载...
取消
保存