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


		#include "scene3d/scene_script_unit.h"

		using namespace GS::S3D;
		using namespace GS::Script;


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

	render_callback = vm->GetObjectFromName("OnRender", self);
	render_done_callback = vm->GetObjectFromName("OnRenderDone", self);
	render_user_callback = vm->GetObjectFromName("OnRenderUser", self);
	render_ui_done_callback = vm->GetObjectFromName("OnRenderUIDone", self);

	update_callback = vm->GetObjectFromName("OnUpdate", self);
	physic_step_callback = vm->GetObjectFromName("OnPhysicStep", self);

	return true;
}
void				SceneScriptUnit::Close()
{
	render_callback = NULL;
	render_done_callback = NULL;
	render_user_callback = NULL;
	render_ui_done_callback = NULL;

	update_callback = NULL;
	physic_step_callback = NULL;

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

//------------------------------------------------------------------------------
SceneScriptUnit::SceneScriptUnit(IVM *vm) : Unit(vm) {}
SceneScriptUnit::~SceneScriptUnit() { Close(); }
//------------------------------------------------------------------------------
