/** 
 * \file Dwarf.h
 * \brief CDwarf class member functions implementation. CDwarf holds model's position and facing.
 * 
 * \author Petar Bajic, MPE (C) All Rights Reserved, Homepage: www.mystic-peanut.com
 * \date January, 16 2007.
 */

#include "d3dx9.h"
#include "Sound.h"
#include "XFileEntity.h"

class CSheep;

/**
 * \brief Dwarf class.
 *
 * CDwarf holds animated skinned mesh instance of a dwarf, adding sound and behaviour to it. 
 * Dwarfs move toward sheep and they are trying to snatch them.
 * \author Petar Bajic \date January, 16 2007.
 */
class CDwarf
{
public:
	CDwarf::CDwarf();
	CDwarf::CDwarf(CXFileEntity* model);
	CDwarf::~CDwarf();

	bool Init(HWND hWnd, LPDIRECT3DDEVICE9 pd3dDevice, IDirectSound8* pDS);
	bool InitSounds(HWND hWnd, IDirectSound8* pDS);
	void OnFrameMove(LPDIRECT3DDEVICE9 pd3dDevice, float fElapsedTime, D3DXMATRIXA16* matWorld);
	void OnRender(LPDIRECT3DDEVICE9 pd3dDevice);
	void Restart();
	void StartPickAnim();

	void GetInTheGame();
	void DieOut();
	void Move(float chunk, double fTime);
	void SnatchSheep();
	void PlaySoundRikoshetDying();
	void PlaySoundBouncingDying();


	CXFileEntity*	m_Model;
	D3DXVECTOR3		m_Position;
	float			m_Facing;
	CSound*			m_SnatchingSound;
	CSound*			m_DyingSound1;
	CSound*			m_DyingSound2;
	bool			m_WalkCenter;
	bool			m_CarryingSheep;
	bool			m_Slowed;
	bool			m_Alive;
	bool			m_Scared;
	bool			m_Hit;
	float			m_HitTime;
	float			m_HitAngle;
	float			m_HitFall;
	bool			m_HitFly;
	float			m_PickAnimTime;
	bool			m_bPickAnim;
	CSheep*			m_TargetSheep;

};
