浏览代码

responded to second round of PR feedback

/main
Steven Leal 4 年前
当前提交
246d4c06
共有 4 个文件被更改,包括 10 次插入2 次删除
  1. 2
      com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers/Randomizers/ColorRandomizer.cs
  2. 8
      com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers/Randomizers/RotationRandomizer.cs
  3. 1
      com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers/Tags/ColorRandomizerTag.cs
  4. 1
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs

2
com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers/Randomizers/ColorRandomizer.cs


var taggedObjects = tagManager.Query<ColorRandomizerTag>();
foreach (var taggedObject in taggedObjects)
{
var renderer = taggedObject.GetComponent<MeshRenderer>();
var renderer = taggedObject.GetComponent<Renderer>();
renderer.material.SetColor(k_BaseColor, colorParameter.Sample());
}
}

8
com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers/Randomizers/RotationRandomizer.cs


using System;
using UnityEngine.Experimental.Perception.Randomization.Parameters;
using UnityEngine.Experimental.Perception.Randomization.Randomizers.SampleRandomizers.Tags;
using UnityEngine.Experimental.Perception.Randomization.Samplers;
namespace UnityEngine.Experimental.Perception.Randomization.Randomizers.SampleRandomizers
{

/// <summary>
/// Defines the range of random rotations that can be assigned to tagged objects
/// </summary>
public Vector3Parameter rotation = new Vector3Parameter();
public Vector3Parameter rotation = new Vector3Parameter
{
x = new UniformSampler(0, 360),
y = new UniformSampler(0, 360),
z = new UniformSampler(0, 360)
};
/// <summary>
/// Randomizes the rotation of tagged objects at the start of each scenario iteration

1
com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers/Tags/ColorRandomizerTag.cs


/// <summary>
/// Used in conjunction with a ColorRandomizer to vary the material color of GameObjects
/// </summary>
[RequireComponent(typeof(Renderer))]
[AddComponentMenu("Perception/RandomizerTags/Color Randomizer Tag")]
public class ColorRandomizerTag : RandomizerTag { }
}

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


}
foreach (var randomizer in m_Randomizers)
randomizer.Create();
ValidateParameters();
}
void OnEnable()

正在加载...
取消
保存