package eu.jonahbauer.wizard.client.libgdx.actions;

import com.badlogic.gdx.scenes.scene2d.Action;

/** Removes an actor from the stage without immediately invalidating its parents. */
public class SilentlyRemoveActorAction extends Action {
	private boolean removed;

	public boolean act (float delta) {
		if (!removed) {
			removed = true;
			if (target.getParent() != null) {
				target.getParent().getChildren().removeValue(target, true);
			}
		}
		return true;
	}

	public void restart () {
		removed = false;
	}
}
