#pragma once

//-----------------------------------------------------
// Include Files
//-----------------------------------------------------
#include "Matrix2D.h"

//-----------------------------------------------------
// Class Forward Declarations
//-----------------------------------------------------
class ResourceLoader;
class Painter;
class InputState;
class Image;
class CollisionMesh;
class TextFormat;
class Audio;

//-----------------------------------------------------
// Character Class									
//-----------------------------------------------------
class Character
{
public:
	Character(ResourceLoader* resourceLoaderPtr,const String& imagename, int hitPoints);				// Constructor
	virtual ~Character();		// Destructor

	//-------------------------------------------------
	// Eigen methoden								
	//-------------------------------------------------
	virtual void Paint(Painter *painterPtr, Matrix2D matView) = 0;
	virtual void Tick(InputState *inputStatePtr) = 0;

	CollisionMesh *GetVCollisionMesh() const;
	CollisionMesh *GetHCollisionMesh() const;
	CollisionMesh *GetWeaponCollisionMesh() const;

	Vector2D GetVelocity() const;
	void SetVelocity(Vector2D vel);

	Point2D GetPosition() const;
	void SetPosition(Point2D pt);

	double GetWidth() const;
	double GetHeight() const;

	void ChangeCurrentHitPoints(int hitPointsModifier);
	int GetCurrentHitPoints() const;
	int GetHitPoints() const;

	void SetHitGround(bool hitGround);
	void SetHitWall(bool hitWall);

	Point2D getPitPos() const;
	void HitPit();
	void ResetPitPos();

	void HitItem(bool hit);
	int GetDamageAmount() const;
	bool GetDead() const;
	void CleanUp();

protected:
	//-------------------------------------------------
	// Datamembers								
	//-------------------------------------------------
	Image *m_ImagePtr;
	CollisionMesh *m_VCollisionMeshPtr, *m_HCollisionMeshPtr, *m_WeaponCollisionMeshPtr;
	Point2D m_Position;
	Vector2D m_Velocity;
	double m_Speed;
	Vector2D m_Gravity;
	Matrix2D m_MatWorld;
	int m_HitPoints;
	int m_CurrentHitPoints;
	int  m_CurrentAnimationStep;
	bool m_HitGround;
	bool m_HitWall;
	bool m_HeadingRight;
	Rect2D m_SpriteBox;
	Point2D m_PitPos;
	int m_CurrentState;
	bool m_HitItem;
	int m_DamageAmount;
	bool m_dead;

	//States:
	static const int STATE_WAITING=0;
	static const int STATE_WALKING=1;
	static const int STATE_JUMPING=2;
	static const int STATE_FALLING=3;
	static const int STATE_LIGHT_ATTACK1=4;
	static const int STATE_LIGHT_ATTACK2=5;
	static const int STATE_LIGHT_ATTACK3=6;
	static const int STATE_HEAVY_ATTACK=7;
	static const int STATE_WALKING_ATTACK=8;
	static const int STATE_JUMP_ATTACK=9;
	static const int STATE_BLOCKING=10;
	static const int STATE_HIT=11;
	static const int STATE_DYING=12;
	static const int STATE_PICKING_UP=13;
	static const int STATE_HOLDING=14;
	static const int STATE_THROWING=15;

	//-------------------------------------------------
	// Eigen methoden								
	//-------------------------------------------------
	virtual void SetCurrentState(int currentState);
	virtual void detectHealthChange(CollisionMesh *collisionMesh, int healthModifier)=0;
	void CheckDead();
private: 
	// -------------------------
	// Disabling default copy constructor and default 
	// assignment operator.
	// -------------------------
	Character(const Character& yRef);									
	Character& operator=(const Character& yRef);	
};

 
