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


		#include "ui/ui_item_script_unit.h"

		using namespace GS::S2D;


//------------------------------------------------------------------------------
bool				ItemScriptUnit::Open()
{
	if	(!Script::Unit::Open())
		return false;

	update_callback = vm->GetObjectFromName("OnUpdate", self);
	trigger_callback = vm->GetObjectFromName("OnTrigger", self);
	activation_callback = vm->GetObjectFromName("OnActivate", self);
	physic_callback = vm->GetObjectFromName("OnPhysicStep", self);
	collision_callback = vm->GetObjectFromName("OnCollision", self);
	collisionex_callback = vm->GetObjectFromName("OnCollisionEx", self);
	render_user_callback = vm->GetObjectFromName("OnRenderUser", self);
	return true;
}
void				ItemScriptUnit::Close()
{
	update_callback = NULL;
	trigger_callback = NULL;
	activation_callback = NULL;
	physic_callback = NULL;
	physic_sleep_callback = NULL;
	collision_callback = NULL;
	collisionex_callback = NULL;
	render_user_callback = NULL;

	Script::Unit::Close();
}
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
ItemScriptUnit::ItemScriptUnit(GS::Script::IVM *vm) : Unit(vm) {}
ItemScriptUnit::~ItemScriptUnit() { Close(); }
//------------------------------------------------------------------------------
