TransmuteOperation createOperation(int entityId) { BitVector componentBits = cm.componentBits(entityId); bs.clear(); bs.or(componentBits); bs.or(additions); bs.andNot(removals); int compositionId = cm.compositionIdentity(bs); return new TransmuteOperation(compositionId, getAdditions(componentBits), getRemovals(componentBits)); }
TransmuteOperation createOperation(int entityId) { BitVector componentBits = cm.componentBits(entityId); bs.clear(); bs.or(componentBits); bs.or(additions); bs.andNot(removals); int compositionId = cm.compositionIdentity(bs); return new TransmuteOperation(compositionId, getAdditions(componentBits), getRemovals(componentBits)); }
/** * Create a new world specific instance of Archetype based on the current state. * * @param world applicable domain of the Archetype. * @return new Archetype based on current state */ public Archetype build(World world) { ComponentType[] types = resolveTypes(world); ComponentManager cm = world.getComponentManager(); ComponentMapper[] mappers = new ComponentMapper[types.length]; for (int i = 0, s = mappers.length; s > i; i++) { mappers[i] = cm.getMapper(types[i].getType()); } int compositionId = cm.compositionIdentity(bitset(types)); TransmuteOperation operation = new TransmuteOperation(compositionId, mappers, new ComponentMapper[0]); return new Archetype(operation, compositionId); }
/** * Create a new world specific instance of Archetype based on the current state. * * @param world applicable domain of the Archetype. * @return new Archetype based on current state */ public Archetype build(World world) { ComponentType[] types = resolveTypes(world); ComponentManager cm = world.getComponentManager(); ComponentMapper[] mappers = new ComponentMapper[types.length]; for (int i = 0, s = mappers.length; s > i; i++) { mappers[i] = cm.getMapper(types[i].getType()); } int compositionId = cm.compositionIdentity(bitset(types)); TransmuteOperation operation = new TransmuteOperation(compositionId, mappers, new ComponentMapper[0]); return new Archetype(operation, compositionId); }