浏览代码

stapled scenario back together

/addressables-test
sleal-unity 4 年前
当前提交
130258c0
共有 1 个文件被更改,包括 19 次插入31 次删除
  1. 50
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs

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


using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;

void Update()
{
// There are two known issues with the starting simulations on the first frame: rendered frames cannot be
// captured and the WaitForEndOfFrame will not function properly on the first frame.
if (Time.frameCount == 1)
return;
switch (state)
{
case State.Initializing:

void IterationLoop()
{
// Perform new iteration tasks
if (currentIterationFrame == 0)
{
ResetRandomStateOnIteration();
OnIterationStart();
foreach (var randomizer in activeRandomizers)
randomizer.IterationStart();
}
// Perform new frame tasks
OnUpdate();
foreach (var randomizer in activeRandomizers)
randomizer.Update();
StartCoroutine(EndOfFrameIterationLoop());
}
IEnumerator EndOfFrameIterationLoop()
{
yield return new WaitForEndOfFrame();
// Iterate scenario frame count
currentIterationFrame++;
framesSinceInitialization++;
// Increment iteration and cleanup last iteration
if (isIterationComplete)
{

OnComplete();
state = State.Idle;
OnIdle();
return;
// Perform new iteration tasks
if (currentIterationFrame == 0)
{
ResetRandomStateOnIteration();
OnIterationStart();
foreach (var randomizer in activeRandomizers)
randomizer.IterationStart();
}
// Perform new frame tasks
OnUpdate();
foreach (var randomizer in activeRandomizers)
randomizer.Update();
// Iterate scenario frame count
currentIterationFrame++;
framesSinceInitialization++;
}
/// <summary>

正在加载...
取消
保存