public <T extends SceneNodeComponent> void removeComponent(Class<T> componentType) { int typeId = ComponentType.findType(componentType); SceneNodeComponent component = _components.get(ComponentType.findBaseType(typeId)); if (component != null && isSubtype(typeId, component.componentType)) { component.destroy(); } }
public String appendDiagnostics(StringBuilder builder) { builder.append("\t"); if (!isActive()) { builder.append("*"); } builder.append(name == null ? "-" : name); builder.append("\n\tComponents ["); for (SceneNodeComponent component : components) { builder.append("\n\t\t"); if (!component.isActive()) { builder.append("*"); } builder.append(component.getClass().getSimpleName()); } builder.append("]"); builder.append("\n\tChildren ["); for (SceneNode child : _childNodes) { builder.append("\n\t\t"); builder.append(child.appendDiagnostics(builder)); } builder.append("]"); return builder.toString(); }
public <T extends SceneNodeComponent> boolean hasComponent( Class<T> type, boolean includeInactive) { int typeId = ComponentType.findType(type); SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId)); return value != null && (includeInactive || value.isActive()) && isSubtype(typeId, value.componentType); }
public <T extends SceneNodeComponent> T getComponent(int typeId, boolean includeInactive) { SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId)); return value != null && (includeInactive || value.isActive()) && isSubtype(typeId, value.componentType) ? Values.<T>cast(value) : null; }
public void removeComponent(SceneNodeComponent component, boolean destroy) { SceneNodeComponent value = _components.get(component.baseComponentType); if (value != component) { return; } if (destroy) { component.destroy(); } else { component.unsetParent(); } }
@Override protected void childRemoved(ManagedObject child) { if (child instanceof SceneNodeComponent) { SceneNodeComponent component = (SceneNodeComponent) child; component.scene = null; _components.remove(component.baseComponentType); _componentBits.clear(component.componentType); } else { SceneNode node = (SceneNode) child; node.scene = null; _childNodes.remove(node); } }
@Override protected final void childAdded(ManagedObject child) { if (child instanceof SceneNodeComponent) { SceneNodeComponent component = (SceneNodeComponent) child; int baseType = component.baseComponentType; if (_components.containsKey(baseType)) { throw new IllegalArgumentException( "Node already contains component: " + component.getClass().getName()); } component.scene = scene; _components.put(baseType, component); _componentBits.set(component.componentType); } else { SceneNode node = (SceneNode) child; node.scene = scene; _childNodes.add(node); } }
public boolean hasComponent(int typeId, boolean includeInactive) { SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId)); return value != null && (includeInactive || value.isActive()) && isSubtype(typeId, value.componentType); }
public void removeComponent(int componentTypeId) { SceneNodeComponent component = _components.get(ComponentType.findBaseType(componentTypeId)); if (component != null && isSubtype(componentTypeId, component.componentType)) { component.destroy(); } }
public void removeComponent(SceneNodeComponent component) { SceneNodeComponent value = _components.get(component.baseComponentType); if (value == component) { component.destroy(); } }
public void addComponent(SceneNodeComponent component) { component.setParent(this); }