//---------------------------
// Includes
//---------------------------
#include "StdAfx.h"
#include "Item.h"

#include "Painter.h"
#include "ResourceLoader.h"
#include "InputState.h"
#include "CollisionMesh.h"
#include "Image.h"
//---------------------------
// Defines
//---------------------------
//

//---------------------------
// Constructor & Destructor
//---------------------------
Item::Item(ResourceLoader* resourceLoaderPtr, const String& imagename)
:LevelProp(resourceLoaderPtr,imagename)
,m_CurrentState(0)
,m_HealthModifier(0)
,m_FireForce(1000)
,m_FireDirectionalForce(0,0)
{
}

Item::~Item()
{
}

//When the item hits the character, the hitpoints of the character will be altered according to the value of the m_HealthModifier
bool Item::HitTest(Character *characterPtr)
{
	CollisionMesh *characterVMesh=characterPtr->GetVCollisionMesh();
	CollisionMesh *characterHMesh=characterPtr->GetHCollisionMesh();

	if(characterVMesh->HitTest(m_CollisionMeshPtr) || characterHMesh->HitTest(m_CollisionMeshPtr))
	{
		characterPtr->ChangeCurrentHitPoints((int)m_HealthModifier);
		return true;
	}
	return false;
}