#pragma	  once

#include <vector>

using namespace std;

enum EffectMotionStep
{
	eEffectMotion_Step_Null				= 0,
	eEffectMotion_Step_Appear,					// 循環特效開始
	eEffectMotion_Step_Idle,					// 循環特效中間(Loop)
	eEffectMotion_Step_Disappear,				// 循環特效結束
	eEffectMotion_Step_Explode,					// 爆炸
	eEffectMotion_Step_Dead,					// 結束
};

enum EffectDamageType
{
	eEffectDamageType_Null				= 0,
	eEffectDamageType_HP,
	eEffectDamageType_MP,
	eEffectDamageType_SP,
};

enum EffectDamageState
{
	eEffectDamageState_Normal,
	eEffectDamageState_Miss,
};

struct EffectDamageValue
{
	int		magicId;
	int		type;
	int		state;
	int		value;
};

class CEffectSprite : public IBaseSprite
{
public:
	CEffectSprite();

	virtual	void					ReceiveDestruct(IBaseSprite* pSprite);
	virtual	void					Update(float elapsed);

	// touch motion event
	virtual	void					MotionEvent( int type );
	
	virtual void					SetRelative(IBaseSprite* pRelative)				{ m_pRelative = pRelative; }
	virtual IBaseSprite*			GetRelative()									{ return m_pRelative; }
	virtual void					SetOffset( CRuVector3& offset )					{ m_offset = offset; }
	virtual CRuVector3				GetOffset()										{ return m_offset; }
	virtual void					SetAttachPoint( int point )						{ m_attachPoint = point; }
	virtual int						GetAttachPoint()								{ return m_attachPoint; }	
	virtual void					SetEffectMotionStep( int step );
	virtual int						GetEffectMotionStep()							{ return m_effectMotionStep; }	
	virtual	void					SetBeginSprite(IBaseSprite* begin, int point);

	virtual void					SetMagicInfo( int id, int type, int state, int value );
	virtual	void					SetAutoDestruct( bool isAutoDestruct )			{ m_isAutoDestruct = isAutoDestruct; }

protected:
	virtual	void					SetEffectPos(CRuVector3& pos, float elapsed);
	virtual	void					ShowDamage();

protected:
	IBaseSprite*					m_pBegin;						// 開始物件
	int								m_beginPoint;					// 開始參考點

	IBaseSprite*					m_pRelative;					// 關連角色物件
	CRuVector3						m_offset;						// 偏移量
	int								m_attachPoint;					// 關連參考點
	int								m_effectMotionStep;
	float							m_effectStepTime;
	bool							m_isAutoDestruct;				// 是否自動刪除本身物件

	// 數值資料
	EffectDamageValue				m_damage;
};

class CLineEffectSprite : public CEffectSprite
{
public:
	CLineEffectSprite();
	virtual ~CLineEffectSprite();

	virtual	void					ReceiveDestruct(IBaseSprite* pSprite);
	virtual void					AttachExplodeEffect( CEffectSprite* pExplode );
	
protected:
	virtual	void					SetEffectPos(CRuVector3& pos, float elapsed);
	virtual void					ReleaseExplode();

protected:
	CRuVector3						m_flyVector;					// 飛行增加量
	float							m_flyDelta;						// 飛行增加量
	vector<CEffectSprite*>			m_attachExplode;				// 串接爆炸特效
};