Esempio n. 1
0
bool TFxSprite::Init(str particleSystem, TFxSpriteAnimTask * task, bool reset )
{
	TFxSpriteRef s = GetRef();

	if (reset)
	{
		mDrawnOnce = false;
		s->GetLPS()->NewScript();
	}

	if (particleSystem.has_data())
	{
		s->GetLPS()->RegisterDataSource("dLocus",&s->mEmitterLocus);
		s->GetLPS()->RegisterDataSource("dUp",&s->mEmitterUp);

		if( !s->GetLPS()->Load(particleSystem) )
		{
			return false;
		}
		s->mName = particleSystem ;
		if (!task)
		{
			task = ((TFxSpriteAnimTask*)GetAnimTask());
		}
		task->mSpriteList.insert( s );
	}
	return true;
}
Esempio n. 2
0
TFxSpriteRef TFxSprite::Create(int32_t layer, str particleSystem, TFxSpriteAnimTask * task )
{
	TFxSpriteRef s= TFxSpriteRef( new TFxSprite(layer) );

	ScriptRegisterMemberFunctor(s->GetLPS()->GetScript(),"CreateFx",s.get(),TFxSprite::CreateFx);
	s->mContainerFolder = particleSystem;
	int lastSlash = s->mContainerFolder.find("/");
	if (lastSlash != str::npos)
	{
		s->mContainerFolder.erase(lastSlash);
	}
	lua_pushlightuserdata(s->GetLPS()->GetScript()->GetState(),s.get());
	lua_setglobal(s->GetLPS()->GetScript()->GetState(),"gParent");

	if (particleSystem.has_data())
	{
		s->Init(particleSystem,task, false);
	}
	return s;
}