public void AfterAdding_IsContained()
        {
            var type   = typeof(Node <SpriteRenderer>);
            var family = Substitute.For <IFamily>();

            _container.Add(type, family);

            Assert.IsTrue(_container.Contains(type));
        }
Пример #2
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);
        }