Exemple #1
0
        internal void AddComponent(byte index, IEcsComponent component)
        {
            EcsArchetype newArchetype = _archetypeManager.FindOrCreateNextArchetype(_archetype, index);

            foreach (byte curIndex in _archetype.Indices)
            {
                IEcsComponentPool componentPool = _archetype.GetComponentPool(curIndex);
                newArchetype.AddComponent(curIndex, componentPool.Get(ArchetypeIndex));
            }

            newArchetype.AddComponent(index, component);

            _archetype.RemoveEntity(this);
            _archetype = newArchetype;
            _archetype.AddEntity(this);
        }