public void GetComponents <T>(Vector <T> dest, bool recursive = false) where T : Component { dest.Clear(); GetComponents(ComponentVector, typeof(T).Name, recursive); for (int i = 0; i < ComponentVector.Size; i++) { if (ComponentVector[i] != null) { dest.Push((T)ComponentVector[i]); } } ComponentVector.Clear(); }
public void GetDerivedCSComponents <T>(Vector <T> dest, bool recursive = false) where T : CSComponent { dest.Clear(); GetComponents(ComponentVector, nameof(CSComponent), recursive); for (int i = 0; i < ComponentVector.Size; ++i) { T t = ComponentVector[i] as T; if (t != null) { dest.Push(t); } } ComponentVector.Clear(); }
public void GetCSComponents <T>(Vector <T> dest, bool recursive = false) where T : CSComponent { dest.Clear(); GetComponents(ComponentVector, nameof(CSComponent), recursive); for (int i = 0; i < ComponentVector.Size; i++) { Component component = ComponentVector[i]; if (component != null && component.GetType() == typeof(T)) { dest.Push((T)component); } } ComponentVector.Clear(); }
public T GetCSComponent <T>(bool recursive = false) where T : CSComponent { GetComponents(ComponentVector, nameof(CSComponent), recursive); for (int i = 0; i < ComponentVector.Size; i++) { Component component = ComponentVector[i]; if (component != null && component.GetType() == typeof(T)) { ComponentVector.Clear(); return((T)component); } } ComponentVector.Clear(); return(null); }