#ifndef _RUCONTROLLER_HIGHLIGHTER_H_
#define _RUCONTROLLER_HIGHLIGHTER_H_

#include "../../Scene/Base/RuEntityBase.h"

#pragma unmanaged

// ************************************************************************************************************************************************************

/*!
	Highlighter controller. Used to produce a strobing highlight effect
	on entities.

	@author John Tang
	@version 2005/11/10
*/
class CRuController_Highlighter : public IRuEntity_Controller
{
	ruRTTI_DECLARE
	ruHEAP_DECLARE
	ruCLASSGUID_DECLARE

protected:
	struct TargetMaterialDesc
	{
		IRuMaterial*						m_targetMaterial;
		IRuShader*							m_oldShader;
		IRuShader*							m_highlighterShader;
	};

	IRuShader*								m_highlighterShader_Static;						//!< Highlighter shader to use for static objects
	CRuEntity*								m_targetEntity;									//!< Entity that the controller affects
	CRuArrayList<TargetMaterialDesc>		m_targetMaterials;								//!< List of affected materials

	REAL									m_pulsePeriod;
	CRuColor4								m_highlightColor_0;
	CRuColor4								m_highlightColor_1;

public:
											CRuController_Highlighter();
	virtual									~CRuController_Highlighter();

	void									SetPulsePeriod(REAL pulsePeriod);
	void									SetHighlightColor0(const CRuColor4 &highlightColor0);
	void									SetHighlightColor1(const CRuColor4 &highlightColor1);

	REAL									GetPulsePeriod() const;
	const CRuColor4&						GetHighlightColor0() const;
	const CRuColor4&						GetHighlightColor1() const;

	virtual BOOL							Update(REAL elapsedTime);

	virtual IRuObject*						GetTarget();
	virtual BOOL							SetTarget(IRuObject *targetEntity);

	// IRuEntityEventListener implementation
	virtual BOOL							HandleEvent(CRuEntity *entity, INT32 eventID, INT32 eventParameter0, INT32 eventParameter1, const char *eventString, REAL eventDuration, void *userData);

protected:
	void									ReleaseTarget();
};

// ************************************************************************************************************************************************************

#pragma managed

#endif
