Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2006, 10:03:19 PM (18 years ago)
Author:
marcscha
Message:

many additions, several fixes

Location:
branches/playability/src/world_entities/particles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/particles/emitter_node.cc

    r10098 r10107  
    2121
    2222#include "util/loading/load_param.h"
     23#include "util/loading/factory.h"
    2324#include "debug.h"
    2425
    2526ObjectListDefinition(EmitterNode);
     27//CREATE_FAST_FACTORY(EmitterNode);
    2628
    2729/**
     
    3234  this->registerObject(this, EmitterNode::_objectList);
    3335
     36  this->toList(OM_DEAD_TICK);
     37
    3438  this->system = NULL;
    3539  this->emitter = NULL;
    3640  this->lifeCycle = 0.0;
    3741  this->lifeSpan = lifetime;
     42
     43  this->setParent( PNode::getNullParent());
    3844}
    3945
     
    6470{
    6571  this->started  = true;
     72
     73  this->emitter->start();
     74  this->emitter->setSystem( this->system);
     75
    6676  return this->started;
    6777}
     
    6979void EmitterNode::tick(float dt)
    7080{
     81
    7182  if( !this->started)
    7283    return;
    7384
    7485  this->lifeCycle += dt/this->lifeSpan;
    75   if  (this->lifeCycle >= 1)
     86
     87  if( this->lifeCycle >= 1.0f)
    7688  {
    7789    this->removeNode();
    78     this->hide();
    79     this->system->removeEmitter(this->emitter);
    8090    this->emitter->stop();
    8191    this->emitter->setSystem(NULL);
    8292    this->started = false;
     93
     94    this->destroy( NULL );
    8395  }
    84   PRINTF(0)("Coordinate Update EmitterNode: (%f,%f,%f) -> (%f,%f,%f)\n",this->getAbsCoor().x,this->getAbsCoor().y,this->getAbsCoor().z,this->velocity.x,this->velocity.y,this->velocity.z);
    85   this->setAbsCoor(this->getAbsCoor() + (this->velocity * dt));
     96  this->shiftCoor(this->velocity * dt);
    8697}
  • branches/playability/src/world_entities/particles/emitter_node.h

    r10098 r10107  
    11/*!
    2  * @file particle_emitter.h
     2 * @file emitter_node.h
    33  *  Definition of a EmitterNode
    44  *  An emitter node is a node that takes an emitter and a particle system and keeps them alive for a given amount of time.
     
    3232  inline void setVelocity(Vector velocity) { this->velocity = velocity;};
    3333
    34   inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->system = system; this->system->setLifeSpan(this->lifeSpan);} ;
     34  inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->emitter->setParent( this); this->system = system;} ;
    3535  void setLifetime( float lifeTime) { this->lifeSpan  = lifeTime;};
    3636
Note: See TracChangeset for help on using the changeset viewer.