📄 effect.cpp
字号:
/**
* File : Effect.cpp
* Author : Kevin Lynx
* Date : 2007/8/2
*/
#include "stdafx.h"
#include "Effect.h"
#include "ResourceMgr.h"
EffectManager::EffectManager( IrrlichtDevice *device )
{
mDevice = device;
}
EffectManager::~EffectManager()
{
}
bool EffectManager::init()
{
release();
return true;
}
void EffectManager::reset()
{
release();
}
void EffectManager::release()
{
for( tFXNodes::iterator it = mExpNodes.begin();
it != mExpNodes.end();
++ it )
{
(*it).mNode->remove();
}
mExpNodes.clear();
}
void EffectManager::update()
{
for( tFXNodes::iterator it = mExpNodes.begin();
it != mExpNodes.end();
++ it )
{
if( (*it).mNode->getMaterial( 0 ).Textures[0] ==
ResourceMgr::GetSingletonPtr()->getLastTexture( (*it).mType ) )
{
// explode finished
(*it).mNode->remove();
it = mExpNodes.erase( it );
}
}
}
void EffectManager::createExp( int type, const vector3df &pos )
{
dimension2d<f32> size( 128, 128 );
if( type == ResourceMgr::EXP_HURT_SPRITE )
{
size.Height = 256;
size.Width = 256;
}
ISceneManager *smgr = mDevice->getSceneManager();
IVideoDriver *driver = mDevice->getVideoDriver();
IBillboardSceneNode *bill = smgr->addBillboardSceneNode();
bill->setMaterialType( video::EMT_TRANSPARENT_ADD_COLOR );
bill->setMaterialFlag( EMF_LIGHTING, false );
bill->setSize( dimension2d<f32>( 128, 128 ) );
bill->setPosition( pos );
ISceneNodeAnimator *anim = smgr->createTextureAnimator(
ResourceMgr::GetSingletonPtr()->getTextureGroup( type )
,50, false );
bill->addAnimator( anim );
anim->drop();
/// store the node
mExpNodes.push_back( ST_ExpNode( bill, type ) );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -