Exemple #1
0
        public void GetComponents <T>(Vector <T> dest, bool recursive = false) where T : Component
        {
            Vector <Component> components = new Vector <Component>();

            GetComponents(components, typeof(T).Name, recursive);
            for (int i = 0; i < components.Size; i++)
            {
                dest.Push((T)components[i]);
            }
        }
Exemple #2
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 #3
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 #4
0
        public void GetDerivedComponents <T>(Vector <T> dest, bool recursive = false) where T : Component
        {
            Vector <Component> components = new Vector <Component>();

            GetComponents(components, recursive);
            for (int i = 0; i < components.Size; ++i)
            {
                T t = components[i] as T;
                if (t != null)
                {
                    dest.Push(t);
                }
            }
        }
Exemple #5
0
        public void GetCSComponents <T>(Vector <T> dest, bool recursive = false) where T : CSComponent
        {
            Vector <Component> components = new Vector <Component>();

            GetComponents(components, nameof(CSComponent), recursive);
            for (int i = 0; i < components.Size; i++)
            {
                Component component = components[i];
                if (component.GetType() == typeof(T))
                {
                    dest.Push((T)component);
                }
            }
        }
Exemple #6
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 #7
0
        public void GetChildrenWithComponent <T>(Vector <Node> dest, bool recursive = false)
        {
            var type = typeof(T);

            // If we're a CSComponent, get "CSComponents" native side and filter here
            if (type.IsSubclassOf(typeof(CSComponent)))
            {
                Vector <Node> temp = new Vector <Node>();

                GetChildrenWithComponent(temp, "CSComponent", recursive);

                // filter based on actual type

                for (uint i = 0; i < temp.Size; i++)
                {
                    var node = temp[i];

                    Vector <Component> components = new Vector <Component>();

                    node.GetComponents(components, "Component", false);

                    for (uint j = 0; j < components.Size; j++)
                    {
                        if (components[j].GetType() == type)
                        {
                            dest.Push(node);
                            break;
                        }
                    }
                }

                return;
            }

            GetChildrenWithComponent(dest, type.Name, recursive);
        }