Пример #1
0
Projectile::Projectile( Type type, const TextureManager & textures, b2Body * body ) :
	Entity( 1, body ),
	pImpl( new Impl( type, textures ) )
{
	// Add particle system for missiles
	if ( IsGuided() )
	{
		std::unique_ptr<EmitterNode> smoke( new EmitterNode( Particle::Type::Smoke ) );
		smoke->setPosition( 0.f, GetBoundingRect().height / 2.f );
		AttachChild( std::move( smoke ) );

		std::unique_ptr<EmitterNode> propellant( new EmitterNode( Particle::Type::Propellant ) );
		propellant->setPosition( 0.f, GetBoundingRect().height / 2.f );
		AttachChild( std::move( propellant ) );
	}
}
Пример #2
0
Projectile::Projectile(Type type, const TextureHolder& textures)
: Entity(1)
, mType(type)
, mSprite(textures.get(Table[type].texture), Table[type].textureRect)
, mTargetDirection()
{
	centerOrigin(mSprite);
    
    // Add particle system for missiles
    if (isGuided())
    {
        std::unique_ptr<EmitterNode> smoke(new EmitterNode(Particle::Smoke));
        smoke->setPosition(0.f, getBoundingRect().height / 2.f);
        attachChild(std::move(smoke));
        
        std::unique_ptr<EmitterNode> propellant(new EmitterNode(Particle::Propellant));
        propellant->setPosition(0.f, getBoundingRect().height / 2.f);
        attachChild(std::move(propellant));
        
    }
}