|
|
|
|
|
|
|
|
|
|
namespace UnityEngine.Experimental.Perception.Randomization.Randomizers.SampleRandomizers |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Creates a 2D layer of of evenly spaced GameObjects from a given list of prefabs
|
|
|
|
/// </summary>
|
|
|
|
List<GameObject> m_SpawnedObjects = new List<GameObject>(); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The Z offset component applied to the generated layer of GameObjects
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The minimum distance between all placed objects
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The size of the 2D area designated for object placement
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The list of prefabs sample and randomly place
|
|
|
|
/// </summary>
|
|
|
|
List<GameObject> m_SpawnedObjects = new List<GameObject>(); |
|
|
|
/// <summary>
|
|
|
|
/// Generates a foreground layer of objects at the start of each scenario iteration
|
|
|
|
/// </summary>
|
|
|
|
protected override void OnIterationStart() |
|
|
|
{ |
|
|
|
var seed = SamplerUtility.IterateSeed((uint)scenario.currentIteration, SamplerUtility.largePrime); |
|
|
|
|
|
|
placementSamples.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Deletes generated foreground objects after each scenario iteration is complete
|
|
|
|
/// </summary>
|
|
|
|
protected override void OnIterationEnd() |
|
|
|
{ |
|
|
|
foreach (var spawnedObject in m_SpawnedObjects) |
|
|
|