Beispiel #1
0
        public void Add(Entity entity)
        {
            int sparseIndex = entity.Index;
            int packedIndex = entities.Add(entity, sparseIndex);

            for (int i = 0; i < components.Length; ++i)
            {
                int           typeIndex   = typeMap.GetSparse(i);
                IArrayWrapper array       = components[i];
                IArrayWrapper sparseArray = sparseComponents.GetArrayWrapper(typeIndex);
                array.AddFrom(packedIndex, sparseArray, entity.Index);
            }

            addedEntities[addedEntitiesCount++] = entity;
        }