@Override public ChangeVariableBrick copyBrickForSprite(Sprite sprite) { Project currentProject = ProjectManager.getInstance().getCurrentProject(); ChangeVariableBrick copyBrick = clone(); copyBrick.userVariable = currentProject.getDataContainer().getUserVariable(userVariable.getName(), sprite); return copyBrick; }
private void cloneSpriteVariables(Project currentProject, Sprite cloneSprite) { DataContainer userVariables = currentProject.getDataContainer(); List<UserVariable> originalSpriteVariables = userVariables.getOrCreateVariableListForSprite(this); List<UserVariable> clonedSpriteVariables = userVariables.getOrCreateVariableListForSprite(cloneSprite); for (UserVariable variable : originalSpriteVariables) { clonedSpriteVariables.add(new UserVariable(variable.getName(), variable.getValue())); } }