您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

45 行
1.3 KiB

using System;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine.Experimental.Perception.Randomization.Samplers;
namespace UnityEngine.Experimental.Perception.Randomization.Parameters
{
/// <summary>
/// Numeric parameters use samplers to generate randomized structs
/// </summary>
/// <typeparam name="T">The sample type of the parameter</typeparam>
[Serializable]
public abstract class NumericParameter<T> : Parameter where T : struct
{
/// <summary>
/// The sample type of parameter
/// </summary>
public sealed override Type sampleType => typeof(T);
/// <summary>
/// Generates one parameter sample
/// </summary>
/// <returns>The generated sample</returns>
public abstract T Sample();
/// <summary>
/// Generates a generic sample
/// </summary>
/// <returns>The generated sample</returns>
public override object GenericSample()
{
return Sample();
}
/// <summary>
/// Validate the settings of this parameter
/// </summary>
public override void Validate()
{
base.Validate();
foreach (var sampler in samplers)
sampler.Validate();
}
}
}