/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


		#include "scene3d/mtrigger.h"
		#include "scene3d/mitem_event_interface.h"
		#include "scene3d/scene_message.h"

		using namespace GS::S3D;


//------------------------------------------------------------------------------
void				MTriggerProxy::MarkItem(GS::Core::Item *item)
{
	MItem *mitem = (MItem *)item->mitem;
	mitem->item_event->OnTrigger(mitem, mtrigger);

	Trigger::MarkItem(item);

	mitem->item_event->OnEnterTrigger(mitem, mtrigger);
	mtrigger->item_event->OnItemEnter(mtrigger, mitem);
}
void				MTriggerProxy::DropItem(GS::Core::Item *item)
{
	MItem *mitem = (MItem *)item->mitem;

	mitem->item_event->OnExitTrigger(mitem, mtrigger);
	mtrigger->item_event->OnItemExit(mtrigger, mitem);

	Trigger::DropItem(item);
}
//------------------------------------------------------------------------------

MTrigger::MTrigger() : MTriggerProxy(this)
{
	item_type = Type_Trigger;
	mitem = (void *)((MItem *)this);
}
