/**
 *
 */
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.engine.camera.Camera;

/**
 * This game action can be used switch to another camera perspective.
 * @author Frank Bruns
 */
public class SetToCamera extends AbstractAction
{
	private int perpectiveId = -1;


	/**
	 * Creates a new camera switching action with the
	 * specified camera perspective id
	 * @param id id of the camera perspective to switch to
	 */
	public SetToCamera(int id)
	{
		this.perpectiveId = id;
	}

	/* (non-Javadoc)
	 * @see de.rico.adventure.actions.AbstractAction#update(long)
	 */
	@Override
	public void update(long elapsedTime)
	{
		// switch camera perspective
		Camera.getInstance().setToCameraPerspective(this.perpectiveId);

		// remove the action from the scheduler
		ActionScheduler.getInstance().removeFirst();
	}

	/* (non-Javadoc)
	 * @see de.rico.adventure.actions.AbstractAction#draw(javax.media.opengl.GL)
	 */
	@Override
	public void draw(GL gl)
	{
		// do nothing
	}

	/* (non-Javadoc)
	 * @see de.rico.adventure.actions.AbstractAction#forceFinish()
	 */
	@Override
	public void finishUp()
	{
		// do nothing at the moment
	}

}
