axmol/extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DObserverManag...

112 lines
4.9 KiB
C++
Raw Normal View History

2015-03-02 13:07:32 +08:00
/****************************************************************************
2015-03-02 16:05:26 +08:00
Copyright (C) 2013 Henry van Merode. All rights reserved.
Copyright (c) 2015 Chukong Technologies Inc.
2015-03-02 13:07:32 +08:00
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
2015-03-02 16:05:26 +08:00
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DObserverManager.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnClearObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnCollisionObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnCountObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnEmissionObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnEventFlagObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnExpireObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnPositionObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnQuotaObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnRandomObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnTimeObserver.h"
#include "extensions/Particle3D/ParticleUniverse/ParticleObservers/CCPUParticle3DOnVelocityObserver.h"
2015-03-02 13:07:32 +08:00
NS_CC_BEGIN
PUParticle3DObserverManager::PUParticle3DObserverManager()
{
}
PUParticle3DObserverManager::~PUParticle3DObserverManager()
{
}
PUParticle3DObserverManager* PUParticle3DObserverManager::Instance()
{
static PUParticle3DObserverManager pem;
return &pem;
}
PUScriptTranslator* PUParticle3DObserverManager::getTranslator( const std::string &type )
{
if (type == "OnClear"){
return &_onClearObserverTranslator;
}else if (type == "OnCollision"){
return &_onCollisionObserverTranslator;
}else if (type == "OnCount"){
return &_onCountObserverTranslator;
}else if (type == "OnEmission"){
return &_onEmissionObserverTranslator;
}else if (type == "OnEventFlag"){
return &_onEventFlagObserverTranslator;
}else if (type == "OnExpire"){
return &_onExpireObserverTranslator;
}else if (type == "OnPosition"){
return &_onPositionObserverTranslator;
}else if (type == "OnQuota"){
return &_onQuotaObserverTranslator;
}else if (type == "OnRandom"){
return &_onRandomObserverTranslator;
}else if (type == "OnTime"){
return &_onTimeObserverTranslator;
}else if (type == "OnVelocity"){
return &_onVelocityObserverTranslator;
}
return nullptr;
}
PUParticle3DObserver* PUParticle3DObserverManager::createObserver( const std::string &type )
{
if (type == "OnClear"){
return PUParticle3DOnClearObserver::create();
}else if (type == "OnCollision"){
return PUParticle3DOnCollisionObserver::create();
}else if (type == "OnCount"){
return PUParticle3DOnCountObserver::create();
}else if (type == "OnEmission"){
return PUParticle3DOnEmissionObserver::create();
}else if (type == "OnEventFlag"){
return PUParticle3DOnEventFlagObserver::create();
}else if (type == "OnExpire"){
return PUParticle3DOnExpireObserver::create();
}else if (type == "OnPosition"){
return PUParticle3DOnPositionObserver::create();
}else if (type == "OnQuota"){
return PUParticle3DOnQuotaObserver::create();
}else if (type == "OnRandom"){
return PUParticle3DOnRandomObserver::create();
}else if (type == "OnTime"){
return PUParticle3DOnTimeObserver::create();
}else if (type == "OnVelocity"){
return PUParticle3DOnVelocityObserver::create();
}
return nullptr;
}
NS_CC_END