package de.rico.adventure.actions.custom;

import javax.media.opengl.GL;

import de.rico.adventure.actions.AbstractAction;
import de.rico.adventure.actions.ActionScheduler;
import de.rico.adventure.inventory.AbstractInventory;

/**
 * This class can be used to deselect the inventory item in a queued
 * manner.
 * @author Frank Bruns
 *
 */
public class DeselectInventoryItem extends AbstractAction
{
	private AbstractInventory inventory = null;

	/**
	 * Creates a new queued game action to deselect the inventory item.
	 * @param inventory invntory to deselect the item of
	 */
	public DeselectInventoryItem(AbstractInventory inventory)
	{
		this.inventory = inventory;
	}

	/* (non-Javadoc)
	 * @see de.rico.adventure.actions.AbstractAction#draw(javax.media.opengl.GL)
	 */
	@Override
	public void draw(GL gl)
	{
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see de.rico.adventure.actions.AbstractAction#finishUp()
	 */
	@Override
	public void finishUp()
	{
		this.inventory.setSelectedInventoryItem(null);
	}

	/* (non-Javadoc)
	 * @see de.rico.adventure.actions.AbstractAction#update(long)
	 */
	@Override
	public void update(long elapsedTime)
	{
		ActionScheduler.getInstance().removeFirst();
	}

}
