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.main.ShootOut3DMain;

/**
 * This is a game action class that can be used to
 * change the chapter of the game.
 * @author Frank Bruns
 *
 */
public class SetChapter extends AbstractAction
{
	private String pathToChapterFile = null;

	/**
	 * Game action that sets the chapter's game to the
	 * specified chapter. The chapter will be loaded from
	 * the specified chapter file.
	 * @param path path to the chapter file (.chp)
	 */
	public SetChapter(String path)
	{
		this.pathToChapterFile = path;
	}

	@Override
	public void draw(GL gl)
	{
		// TODO Auto-generated method stub

	}

	@Override
	public void finishUp()
	{
		// TODO Auto-generated method stub

	}

	@Override
	public void update(long elapsedTime)
	{
		ShootOut3DMain.getInstance().setActiveChapter(this.pathToChapterFile);
		ActionScheduler.getInstance().removeFirst();
	}

}
