Example #1
0
        public INodeList <T> GetNodes <T>() where T : Node
        {
            var         type = typeof(T);
            IFamily <T> family;

            if (_families.Contains(type))
            {
                family = _families.Get(type) as IFamily <T>;
            }
            else
            {
                family = _familyFactory.Produce <T>();
                _families.Add(type, family);

                foreach (var entity in _entities)
                {
                    family.EntityAdded(entity);
                }
            }

            return(family.Nodes);
        }
Example #2
0
        public INodeList <T> GetNodes <T>()
        {
            var         type = typeof(T);
            IFamily <T> family;

            if (_families.ContainsKey(type))
            {
                family = _families[type] as IFamily <T>;
            }
            else
            {
                family          = _familyFactory.Produce <T>();
                _families[type] = family;

                foreach (var entity in _entities)
                {
                    family.EntityAdded(entity);
                }
            }

            return(family.Nodes);
        }