Exemple #1
0
 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();
 }
Exemple #2
0
 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();
 }
Exemple #3
0
 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();
 }
Exemple #4
0
        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);
        }