Exemplo n.º 1
0
	void EngineExhaustNode::addNozzle( irr::core::vector3df offset )
	{
		auto fire = SceneManager->addParticleSystemSceneNode(false, this, 0);
		fire->setParticleBehavior( EPB_EMITTER_VECTOR_IGNORE_ROTATION | EPB_EMITTER_FRAME_INTERPOLATION);

		fire->setParticlesAreGlobal(true);

		//Emitter
		auto emitter = fire->createSphereEmitter(
				offset, mRadius, vector3df(0,0,-1), 20, 20,
				SColor(255,255,255,255), SColor(255,255,255,255),
				mParticleLifetime - 100, mParticleLifetime, 5, dimension2df(mParticleSize, mParticleSize), dimension2df( mParticleSize * 1.5, mParticleSize * 1.5));

		fire->setEmitter(emitter);

		fire->addAffector(mFadeOutAffector);
		fire->addAffector(mScaleAffector);

		fire->setMaterialFlag(EMF_LIGHTING, false);
		fire->setMaterialTexture(0, mFireTexture);
		fire->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
		//fire->setMaterialType( EMT_TRANSPARENT_ALPHA_CHANNEL );

		mFireEmitters.push_back( fire );
	}
void LeprechaunSound::update(const GameTime& gameTime)
{
	SoundComponent::update(gameTime);

	LeprechaunController& leprechaun = getController();
	setEmitter(leprechaun.getPosition(), leprechaun.getForward(), Vector3::up);

	if (leprechaun.isBeginKick() || leprechaun.isBeginCaneAnimation() || leprechaun.isBeginHatAnimation())
		play3DSound("hey");

	if (leprechaun.isBeginCaneHit() || leprechaun.isBeginFly() || leprechaun.isBeginStoneHit())
		play3DSound("punch");

	if (!leprechaun.isLocal())
		return;

	if (leprechaun.hasUsedItem())
	{
		stopSound("yes hahaha");
		playSound("yes hahaha");
		//play3DSound("yes hahaha");
	}

	if (leprechaun.hasCollectedItem())
	{
		stopSound("door slamming");
		playSound("door slamming");
		//play3DSound("door slamming");
	}
}
Exemplo n.º 3
0
void ItemsList::onMouseDragStop(Event::Mouse* event)
{
    _draggedItem->setOffset(0, 0);
    _draggedItem->setType(_type);
    auto itemevent = new Event::Mouse("itemdragstop");
    itemevent->setPosition(event->position());
    itemevent->setEmitter(this);
    emitEvent(itemevent);
    delete itemevent;
    _draggedItem = 0;
    Logger::critical() << "mousedragstop" << std::endl;
}
Exemplo n.º 4
0
SpawnParticlesAction::SpawnParticlesAction(
    unsigned int minNb,
    unsigned int maxNb,
    const Ref<Group>& group,
    const Ref<Emitter>& emitter) :
    minNb(minNb),
    maxNb(maxNb),
    baseEmitter(),
    targetGroup(group)
{
    setEmitter(emitter);
}
Exemplo n.º 5
0
void LLGameSound::update(const GameTime& gameTime)
{
	SoundComponent::update(gameTime);
	
	const SoundManager::AudioListener& listener = getManager().getListener();
	setEmitter((Vector3)listener.Position, (Vector3)listener.OrientFront, (Vector3)listener.OrientTop);

	LLGameLogic& gameLogic = getController();
	const LLGameLogic::ExplosionList& explosions = gameLogic.getExplosions();
	for(LLGameLogic::ExplosionList::const_iterator it = explosions.begin(); it != explosions.end(); ++it)
		playStatic3DSound("explosion", *it);
	gameLogic.clearExplosions();
}
Exemplo n.º 6
0
void PlayerEditNameState::onKeyboardPress(std::shared_ptr<KeyboardEvent> event)
{
    auto sender = dynamic_cast<TextArea*>(event->emitter());
    auto state = dynamic_cast<PlayerEditNameState*>(event->reciever());

    std::string text = sender->text();

    if (event->keyCode() == SDLK_BACKSPACE) //backspace
    {
        if (text.length() > 0)
        {
            text = text.substr(0, text.length() - 1);
            sender->setText(text.c_str());
            return;
        }
        return;
    }

    if (event->keyCode() == SDLK_RETURN) //enter
    {
        auto mouseEvent = new MouseEvent();
        mouseEvent->setEmitter(event->emitter());
        mouseEvent->setReciever(event->reciever());
        onDoneButtonClick(mouseEvent);
        delete mouseEvent;
        return;
    }

    if (event->keyCode() == SDLK_LSHIFT || event->keyCode() == SDLK_RSHIFT) return;
    if (event->keyCode() == SDLK_LCTRL || event->keyCode() == SDLK_RCTRL) return;
    if (event->keyCode() == SDLK_LALT || event->keyCode() == SDLK_RALT) return;

    if (text.length() == 11) return;

    if (state->_keyCodes.find(event->keyCode()) != state->_keyCodes.end())
    {
        char chr = state->_keyCodes.at(event->keyCode());

        if (event->shiftPressed())
        {
            text += toupper(chr);
        }
        else
        {
            text += chr;
        }
        sender->setText(text.c_str());
    }
}
Exemplo n.º 7
0
	ParticleSystemNode::ParticleSystemNode(Scene *scene_) : Node(scene_) {
		type = NODE_PARTICLESYSTEM;
		timeToSpawn = 0;

		box = BBox(vec3(-0.5, -0.5, -0.5), vec3(0.5, 0.5, 0.5));
		particleBox = box;
		sphere = BSphere(vec3(), 0.5);
		first_update = true;

		setSpawnRate(5.0f);
		setLife(5.0f, 0.0f);
		setSize(0.1f, 0.0f);
		setGrowth(1.0f, 0.0f);
		setEmitter(EMITTER_BOX);
		setColor(vec3(0.5f, 0.5f, 0.0f), vec3(1.0f, 0.0f, 0.0f));
		setSpeed(0.1f, 0.0f, 0.0f);
		setGravity(0.0f);
		setName(getTypeName());
	}
Exemplo n.º 8
0
//! constructor
CParticleSystemSceneNode::CParticleSystemSceneNode(bool createDefaultEmitter,
	ISceneNode* parent, ISceneManager* mgr, s32 id,
	const core::vector3df& position, const core::vector3df& rotation,
	const core::vector3df& scale)
	: IParticleSystemSceneNode(parent, mgr, id, position, rotation, scale),
	Emitter(0), ParticleSize(core::dimension2d<f32>(5.0f, 5.0f)), LastEmitTime(0),
	MaxParticles(0xffff), Buffer(0), ParticlesAreGlobal(true)
{
	#ifdef _DEBUG
	setDebugName("CParticleSystemSceneNode");
	#endif

	Buffer = new SMeshBuffer();
	if (createDefaultEmitter)
	{
		IParticleEmitter* e = createBoxEmitter();
		setEmitter(e);
		e->drop();
	}
}
//! constructor
CParticleSystemSceneNode::CParticleSystemSceneNode(bool createDefaultEmitter,
	ISceneNode* parent, ISceneManager* mgr, s32 id, 
	const core::vector3df& position, const core::vector3df& rotation,
	const core::vector3df& scale)
	: IParticleSystemSceneNode(parent, mgr, id, position, rotation, scale),
	Emitter(0), ParticlesAreGlobal(true)
{
	#ifdef _DEBUG
	setDebugName("CParticleSystemSceneNode");
	#endif

	if (createDefaultEmitter)
	{
		IParticleEmitter* e = createBoxEmitter();
		setEmitter(e);
		e->drop();
	}

	setParticleSize();
}