コード例 #1
0
        internal void ComponentRemoved(Entity mEntity, Component mComponent)
        {
            var componentType = mComponent.GetType();

            _components[componentType].Remove(mComponent);
            _componentEntities[componentType].Remove(mEntity);
        }
コード例 #2
0
        internal void ComponentAdded(Entity mEntity, Component mComponent)
        {
            var componentType = mComponent.GetType();

            if (!_components.ContainsKey(componentType))
            {
                _components.Add(componentType, new HashSet<Component>());
                _componentEntities.Add(componentType, new HashSet<Entity>());
            }

            _components[componentType].Add(mComponent);
            _componentEntities[componentType].Add(mEntity);
        }