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

//-----------------------------------------------------
// Include Files
//-----------------------------------------------------
#include "GameEngine.h"
#include "EntityMaster.h"
#include "Mario.h"
#include "Level.h"
//-----------------------------------------------------
// Mushroom Class									
//-----------------------------------------------------
class Mushroom : public EntityMaster
{
public:
	Mushroom(int x, int y, Bitmap *bmpBitmapPtr, int type = 0);				// Constructor
	virtual ~Mushroom();		// Destructor

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

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

	virtual DOUBLE2 GetPos();
	virtual RECT2 GetAABBRect();
	virtual bool IsHit();
	virtual int ReturnReward();
	virtual void DrawDebug(MATRIX3X2 matView);
	virtual void Delete();
	virtual void Move(DOUBLE2 dir);
	virtual void ZeroVelocity(bool xVelocity, bool yVelocity);
	virtual int GetType();
	// 0 = locked
	// 1 = popout
	// 2 = pickup
	// 3 = destroyed
	void SetStage(int stage);

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

	//0 = normal (standard)
	//1 = 1 UP
	int GetMushroomType();


	// statics
	static const int NR_STEPS = 2;
	static const int SPEED = 2000;				// 300
	//static const int POP_SPEED_MUSHROOM = 50;
	static const int FORCE_GRAVITY = 800;		// 800

private: 
	enum class TYPE : int
	{
		NORMAL,
		UP
	};

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

	void LockedTick(double deltaTime);
	void PopoutTick(double deltaTime);
	void PickUpTick(double deltaTime);
	void DestroyedTick(double deltaTime);

	void LevelCollisionH(HitRegion *hitLevelPtr);
	void LevelCollisionV(HitRegion *hitLevelPtr);

	//void LockedPaint(MATRIX3X2 matView);
	//void PopoutPaint(MATRIX3X2 matView);
	//void PickUpPaint(MATRIX3X2 matView);
	//void DestroyedPaint(MATRIX3X2 matView);

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

	bool m_GoesRight, m_IsDestroyed;
	int m_Width, m_Height, m_EndHeight, m_MushroomType;

	DOUBLE2 m_Position, m_Velocity;
	RECT m_Clip;
	RECT2 m_AABB;
	Bitmap *m_BmpMushroomPtr;
	HitRegion *m_HitLevelPtr;

	TYPE m_Type;
	STAGE m_Stage;


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


