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


		#include "ui/ui_scene_script_event.h"
		#include "ui/ui_script_unit.h"
		#include "ui/ui.h"
		#include "script/scripted_object.h"

		using namespace GS::S2D;


//------------------------------------------------------------------------------
void				SceneScriptEvent::OnSetup(Scene *scene)
{
	ListForeachPtr(Script::Unit *, unit, scene->scripted_object->GetUnitList())
		if	(unit->SetupFunctionCall("OnSetup"))
			unit->DoFunctionCall(0);
}
void				SceneScriptEvent::OnReset(Scene *scene)
{
	ListForeachPtr(Script::Unit *, unit, scene->scripted_object->GetUnitList())
		if	(unit->SetupFunctionCall("OnReset"))
			unit->DoFunctionCall(0);
}
void				SceneScriptEvent::OnUpdate(Scene *scene)
{
	ListForeachPtr(Script::Unit *, unit, scene->scripted_object->GetUnitList())
		if	(unit->SetupFunctionCall("OnUpdate", ((SceneUnit *)unit)->frame_callback))
			unit->DoFunctionCall(0);
}
void				SceneScriptEvent::OnDelete(Scene *scene)
{
	ListForeachPtr(Script::Unit *, unit, scene->scripted_object->GetUnitList())
		if	(unit->SetupFunctionCall("OnDelete"))
			unit->DoFunctionCall(0);
}
//------------------------------------------------------------------------------
