using System;
namespace UnityEngine.Perception.Randomization.Scenarios
{
///
/// A scenario that runs for a fixed number of frames during each iteration
///
[AddComponentMenu("Perception/Randomization/Scenarios/Fixed Length Scenario")]
public class FixedLengthScenario: Scenario
{
///
/// Constants describing the execution of this scenario
///
[Serializable]
public class Constants
{
///
/// The number of frames to generate per iteration
///
public int framesPerIteration = 1;
///
/// The iteration index begin the simulation on
///
public int startingIteration;
///
/// The total number of iterations to complete before the simulation terminates
///
public int totalIterations = 1000;
}
///
/// Returns whether the current scenario iteration has completed
///
public override bool isIterationComplete => currentIterationFrame >= constants.framesPerIteration;
///
/// Returns whether the scenario has completed
///
public override bool isScenarioComplete => currentIteration >= constants.totalIterations;
///
/// Called before the scenario begins iterating
///
public override void OnInitialize()
{
currentIteration = constants.startingIteration;
}
}
}