package de.rico.adventure.entity.character;

import de.rico.adventure.actions.ActionScheduler;
import de.rico.adventure.actions.custom.Say;
import de.rico.adventure.conversation.Sentence;
import de.rico.adventure.entity.AbstractEntity;
import de.rico.adventure.structure.Room;
import de.rico.engine.geometry.AbstractMesh;

/**
 * This is the abstract base class for all the characters in the game.
 * @author Frank Bruns
 */
public abstract class AbstractCharacter extends AbstractEntity
{
	private Room currentRoom = null;

	/**
	 * Creates a new character with the specified mesh to use as a model.
	 * @param mesh mesh to use as a model
	 */
	public AbstractCharacter(AbstractMesh mesh)
	{
		super(mesh);
	}

	/**
	 * Sets the characters current room.
	 * @param room room the character is located in
	 */
	public void setRoom(Room room)
	{
		this.currentRoom = room;
	}

	/**
	 * Returns the characters current room or <code>null</code>,
	 * if none can be reference to the character.
	 * @return room the character is currently located in,
	 * or <code>null</code>
	 */
	public Room getRoom()
	{
		return this.currentRoom;
	}

	/**
	 * Displays the specified text as a queued Say action.
	 * @param text text to say
	 */
	public void say(String text)
	{
		ActionScheduler.getInstance().add(new Say(new Sentence(this,text)));
	}

	/**
	 * Displays the specified text as a queued Say action.
	 * @param text text to say
	 * @param pathSound path to sound file for the sentence
	 */
	public void say(String text, String pathSound)
	{
		ActionScheduler.getInstance().add(new Say(new Sentence(this,text,pathSound)));
	}
}
