/**
 *
 */
package de.rico.adventure.actions.custom.concurrent;

import javax.media.opengl.GL;

import de.rico.adventure.entity.AbstractEntity;

/**
 * This class is the abstract base class for any kind of concurrent game action.
 * @author Frank Bruns
 */
public abstract class AbstractConcurrentAction
{
	private AbstractEntity entity = null;

	/**
	 * Creates a new concurrent game action without a specified entity.
	 *
	 */
	public AbstractConcurrentAction()
	{

	}

	/**
	 * Creates a new concurrent game action for the specified entity.
	 * @param e entity for this game action
	 */
	public AbstractConcurrentAction(AbstractEntity e)
	{
		this.entity = e;
	}

	/**
	 * Returns the entity of the concurrent game action, if it has one,
	 * else <code>null</code>.
	 * @return entity of the game action, or <code>null</code>
	 */
	public AbstractEntity getEntity()
	{
		return this.entity;
	}

	/**
	 * Implementations of this method hold code that needs to be called
	 * before the game action can be removed from the concurrent queue (prematurely)
	 * without causing side effects.
	 *
	 */
	public abstract void finishUp();

	/**
	 * This method updates the concurrent game action
	 * @param elapsedTime time between two frames
	 */
	public abstract void update(long elapsedTime);

	/**
	 * This method renders the concurrent game action, if needed.
	 * @param gl
	 */
	public abstract void draw(GL gl);
}
