#pragma once
//-----------------------------------------------------
// Name, first name: Hoet, Guntran
// Group: 1DAE3
//-----------------------------------------------------

//-----------------------------------------------------
// Include Files
//-----------------------------------------------------
#include "GameEngine.h"
#include "EntityMaster.h"
#include "HUD.h"
#include "Sound.h"
//-----------------------------------------------------
// CoinBlock Class									
//-----------------------------------------------------
class CoinBlock : public EntityMaster
{
public:
	CoinBlock(int x, int y, Bitmap *bmpBitmapPtr);				// Constructor
	virtual ~CoinBlock();		// Destructor

	//-------------------------------------------------
	// Methods - Member functions							
	//-------------------------------------------------

	virtual void Paint(MATRIX3X2 matView);
	virtual void Tick(double deltaTime);

	virtual DOUBLE2 GetPos();
	virtual void DrawDebug(MATRIX3X2 matView);
	virtual RECT2 GetAABBRect();

	virtual bool IsHit();
	virtual int ReturnReward();
	virtual void Delete();
	virtual void Move(DOUBLE2 dir);
	virtual void ZeroVelocity(bool xVelocity, bool yVelocity);
	virtual int GetType();
	virtual int GetMushroomType();

	//static const int POP_SPEED_COINBLOCK = 120;		// if a prefered speed is wanted
	static const int ANIM_STEPS = 4;
	static const int ANIM_INTERVAL = 3;

private: 
	//-------------------------------------------------
	// Enums								
	//-------------------------------------------------

	enum class STAGE : int
	{
		LOCKED,
		POPOUT,
		PICKUP,
		DESTROYED
	};

	//-------------------------------------------------
	// Methods								
	//-------------------------------------------------

	void PopOutTick(double deltaTime);
	void AnimationTick();

	// 0 = locked
	// 1 = popout
	// 2 = pickup
	// 3 = destroyed
	int GetStage();

	// 0 = locked
	// 1 = popout
	// 2 = pickup
	// 3 = destroyed
	void SetStage(int stage);


	//-------------------------------------------------
	// Datamembers								
	//-------------------------------------------------

	bool m_IsDestroyed;

	int m_Width, m_Height, m_EndHeight;
	int m_TickCount, m_AnimationStep;

	DOUBLE2 m_Position;
	RECT m_Clip;

	Bitmap *m_BmpBitmapPtr;

	STAGE m_Stage;

	// -------------------------
	// Disabling default copy constructor and default 
	// assignment operator.
	// -------------------------
	CoinBlock(const CoinBlock& yRef);									
	CoinBlock& operator=(const CoinBlock& yRef);	
};


