浏览代码

Added non-generic has/add/remove volume methods

/namespace
Thomas 7 年前
当前提交
db50da98
共有 1 个文件被更改,包括 16 次插入4 次删除
  1. 20
      ScriptableRenderPipeline/Core/Volume/Volume.cs

20
ScriptableRenderPipeline/Core/Volume/Volume.cs


public T Add<T>(bool overrides = false)
where T : VolumeComponent
{
if (Has<T>())
return (T)Add(typeof(T), overrides);
}
public VolumeComponent Add(Type type, bool overrides = false)
{
if (Has(type))
var component = ScriptableObject.CreateInstance<T>();
var component = (VolumeComponent)ScriptableObject.CreateInstance(type);
component.SetAllOverridesTo(overrides);
components.Add(component);
isDirty = true;

public void Remove<T>()
where T : VolumeComponent
{
Remove(typeof(T));
}
public void Remove(Type type)
{
var type = typeof(T);
for (int i = 0; i < components.Count; i++)
{

public bool Has<T>()
where T : VolumeComponent
{
var type = typeof(T);
return Has(typeof(T));
}
public bool Has(Type type)
{
foreach (var component in components)
{
if (component.GetType() == type)

正在加载...
取消
保存