浏览代码

responding to more PR feedback

/main
Steven Leal 4 年前
当前提交
0b8c42ba
共有 4 个文件被更改,包括 11 次插入8 次删除
  1. 11
      com.unity.perception/Runtime/Randomization/Randomizers/Randomizer.cs
  2. 8
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
  3. 0
      /com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples
  4. 0
      /com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples.meta

11
com.unity.perception/Runtime/Randomization/Randomizers/Randomizer.cs


using System;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine.Experimental.Perception.Randomization.Parameters;
using UnityEngine.Experimental.Perception.Randomization.Scenarios;

{
bool m_PreviouslyEnabled;
// ReSharper disable once InconsistentNaming
internal ScenarioBase m_Scenario;
ScenarioBase m_Scenario;
internal RandomizerTagManager m_TagManager;
RandomizerTagManager m_TagManager;
[HideInInspector, SerializeField] internal bool collapsed;

/// OnUpdate is executed every frame for enabled Randomizers
/// </summary>
protected virtual void OnUpdate() { }
internal void Initialize(ScenarioBase parentScenario, RandomizerTagManager parentTagManager)
{
m_Scenario = parentScenario;
m_TagManager = parentTagManager;
}
internal virtual void Create()
{

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


activeScenario = this;
OnAwake();
foreach (var randomizer in m_Randomizers)
{
randomizer.m_Scenario = this;
randomizer.m_TagManager = tagManager;
}
randomizer.Initialize(this, tagManager);
foreach (var randomizer in m_Randomizers)
randomizer.Create();
ValidateParameters();

$"Two Randomizers of the same type ({randomizerType.Name}) cannot both be active simultaneously");
var newRandomizer = (Randomizer)Activator.CreateInstance(randomizerType);
m_Randomizers.Add(newRandomizer);
newRandomizer.m_Scenario = this;
newRandomizer.m_TagManager = tagManager;
newRandomizer.Initialize(this, tagManager);
newRandomizer.Create();
return newRandomizer;
}

/com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers → /com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples

/com.unity.perception/Runtime/Randomization/Randomizers/SampleRandomizers.meta → /com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples.meta

正在加载...
取消
保存