本文整理汇总了C++中ParticleEffect::GetColorFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEffect::GetColorFrame方法的具体用法?C++ ParticleEffect::GetColorFrame怎么用?C++ ParticleEffect::GetColorFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect::GetColorFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Set
void Explosion::Set(const Vector3 position, const Color color, const float size)
{
Effect::Set(position);
rootNode_->SetScale(size);
initialMass_ = 3.0f * size;
rigidBody_->SetMass(initialMass_);
light_->SetColor(color);
light_->SetBrightness(initialBrightness_);
ParticleEffect* particleEffect = particleEmitter_->GetEffect();
Vector<ColorFrame> colorFrames;
colorFrames.Push(ColorFrame(Color(0.0f, 0.0f, 0.0f, 0.0f), 0.0f));
Color mixColor = 0.5f * (color + particleEffect->GetColorFrame(1)->color_);
colorFrames.Push(ColorFrame(mixColor, 0.1f));
colorFrames.Push(ColorFrame(mixColor*0.1f, 0.35f));
colorFrames.Push(ColorFrame(Color(0.0f, 0.0f, 0.0f, 0.0f), 0.0f));
particleEffect->SetColorFrames(colorFrames);
sampleSource_->SetGain(Min(0.5f*size, 1.0f));
sampleSource_->Play(sample_);
masterControl_->tileMaster_->AddToAffectors(WeakPtr<Node>(rootNode_), WeakPtr<RigidBody>(rigidBody_));
SubscribeToEvent(E_POSTUPDATE, URHO3D_HANDLER(Explosion, UpdateExplosion));
}
示例2: Effect
Explosion::Explosion(Context *context, MasterControl *masterControl, Vector3 position, Color color, double size):
Effect(context, masterControl, position),
initialMass_{static_cast<float>(3.0f*size)},
initialBrightness_{8.0f}
{
rootNode_->SetName("Explosion");
rootNode_->SetPosition(position);
rootNode_->SetScale(size);
rigidBody_ = rootNode_->CreateComponent<RigidBody>();
rigidBody_->SetMass(initialMass_);
rigidBody_->SetLinearFactor(Vector3::ONE - Vector3::UP);
light_ = rootNode_->CreateComponent<Light>();
light_->SetRange(13.0f);
light_->SetColor(color);
light_->SetBrightness(initialBrightness_);
particleEmitter_ = rootNode_->CreateComponent<ParticleEmitter>();
ParticleEffect* particleEffect = masterControl_->cache_->GetResource<ParticleEffect>("Resources/Particles/Explosion.xml");
Vector<ColorFrame> colorFrames;
colorFrames.Push(ColorFrame(Color(0.0f, 0.0f, 0.0f, 0.0f), 0.0f));
Color mixColor = 0.5f * (color + particleEffect->GetColorFrame(1)->color_);
colorFrames.Push(ColorFrame(mixColor, 0.1f));
colorFrames.Push(ColorFrame(mixColor*0.1f, 0.35f));
colorFrames.Push(ColorFrame(Color(0.0f, 0.0f, 0.0f, 0.0f), 0.0f));
particleEffect->SetColorFrames(colorFrames);
particleEmitter_->SetEffect(particleEffect);
sample_ = masterControl_->cache_->GetResource<Sound>("Resources/Samples/Explode.ogg");
sample_->SetLooped(false);
sampleSource_ = rootNode_->CreateComponent<SoundSource>();
sampleSource_->SetGain(Min(0.5f*size, 1.0f));
sampleSource_->SetSoundType(SOUND_EFFECT);
sampleSource_->Play(sample_);
masterControl_->tileMaster_->AddToAffectors(WeakPtr<Node>(rootNode_), WeakPtr<RigidBody>(rigidBody_));
SubscribeToEvent(E_POSTUPDATE, HANDLER(Explosion, UpdateExplosion));
}