|
|
|
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine.Assertions; |
|
|
|
|
|
|
|
namespace UnityEngine.Experimental.Rendering |
|
|
|
{ |
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public bool HasSubclassOf(Type type) |
|
|
|
{ |
|
|
|
foreach (var component in components) |
|
|
|
{ |
|
|
|
if (component.GetType().IsSubclassOf(type)) |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return TryGet(type, out component); |
|
|
|
} |
|
|
|
|
|
|
|
public bool TryGet<T>(Type type, out T component) |
|
|
|
where T : VolumeComponent |
|
|
|
{ |
|
|
|
component = null; |
|
|
|
|
|
|
|
foreach (var comp in components) |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public bool TryGetSubclassOf<T>(Type type, out T component) |
|
|
|
where T : VolumeComponent |
|
|
|
{ |
|
|
|
component = null; |
|
|
|
|
|
|
|
foreach (var comp in components) |
|
|
|
{ |
|
|
|
if (comp.GetType().IsSubclassOf(type)) |
|
|
|
{ |
|
|
|
component = (T)comp; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public bool TryGetAllSubclassOf<T>(Type type, List<T> component) |
|
|
|
where T : VolumeComponent |
|
|
|
{ |
|
|
|
Assert.IsNotNull(components); |
|
|
|
int count = component.Count; |
|
|
|
|
|
|
|
foreach (var comp in components) |
|
|
|
{ |
|
|
|
if (comp.GetType().IsSubclassOf(type)) |
|
|
|
components.Add(comp); |
|
|
|
} |
|
|
|
|
|
|
|
return count != component.Count; |
|
|
|
} |
|
|
|
} |
|
|
|
} |