Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5744 in orxonox.OLD for branches


Ignore:
Timestamp:
Nov 23, 2005, 9:28:06 PM (19 years ago)
Author:
stefalie
Message:

da bomb

Location:
branches/world_entities/src/world_entities/weapons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/world_entities/src/world_entities/weapons/bomb.cc

    r5603 r5744  
    1616#include "bomb.h"
    1717#include "glincl.h"
     18#include "state.h"
     19#include "list.h"
    1820#include "model.h"
     21#include "vector.h"
    1922#include "fast_factory.h"
     23
     24
     25#include "particle_engine.h"
     26#include "particle_emitter.h"
     27#include "particle_system.h"
    2028
    2129using namespace std;
     
    3240  if (root != NULL)
    3341    this->loadParams(root);
     42
     43  float modelSize = 1.0;
     44  this->loadModel("models/projectiles/RadioActiveBomb.obj", 1.0);
     45
     46  this->energyMin = 1;
     47  this->energyMax = 1;
     48  this->remove();
     49  this->lifeSpan = 15;
     50
     51  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
     52  this->emitter->setParent(this);
     53  this->emitter->setSpread(M_PI, M_PI);
    3454}
    3555
     
    82102void Bomb::tick(float time)
    83103{
     104  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     105  Vector v = this->velocity * (time);
     106  this->shiftCoor(v);
    84107
     108  this->lifeCycle += time/this->lifeSpan;
     109  if( this->lifeCycle >= 1.0)
     110    {
     111      PRINTF(5)("FINALIZE==========================\n");
     112      PRINTF(5)("current life cycle is: %f\n", this->lifeCycle);
     113      PRINTF(5)("FINALIZE===========================\n");
     114
     115      this->deactivate();
     116    }
    85117}
    86118
     
    114146void Bomb::collidesWith (WorldEntity* entity, const Vector& location)
    115147{
    116 
     148        this->detonate();
    117149}
    118150
    119151void Bomb::activate()
    120152{
     153  State::getWorldEntityList()->add(this);
    121154
    122155}
     
    124157void Bomb::deactivate()
    125158{
     159  State::getWorldEntityList()->remove(this);
     160  Bomb::fastFactory->kill(this);
     161}
    126162
     163void Bomb::detonate()
     164{
     165  tIterator<WorldEntity>* it = State::getWorldEntityList()->getIterator();
     166  WorldEntity* lm = it->firstElement();
     167
     168  while(lm != NULL)
     169  {
     170   
     171    lm = it->nextElement();
     172  }
    127173}
  • branches/world_entities/src/world_entities/weapons/bomb.h

    r5603 r5744  
    99#include "projectile.h"
    1010class FastFactory;
     11class ParticleSystem;
     12class ParticleEmitter;
    1113
    1214//! A Class to ...
     
    2931  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    3032  virtual void activate();
     33  virtual void detonate();
    3134  virtual void deactivate();
    3235
    3336 private:
    3437  static FastFactory*               fastFactory;
     38  static ParticleSystem*            trailParticles;
     39  static ParticleSystem*            explosionParticles;
     40
     41  ParticleEmitter*                  emitter;
    3542
    3643};
  • branches/world_entities/src/world_entities/weapons/cannon.cc

    r5623 r5744  
    7878  this->loadModel("models/guns/cannon.obj");
    7979
    80   this->setStateDuration(WS_SHOOTING, .1);
     80  this->setStateDuration(WS_SHOOTING, 2.0);
    8181  this->setStateDuration(WS_RELOADING, .1);
    82   this->setStateDuration(WS_ACTIVATING, .4);
     82  this->setStateDuration(WS_ACTIVATING, .1);
    8383  this->setStateDuration(WS_DEACTIVATING, .4);
    8484
    85   this->setMaximumEnergy(1000, 100);
    86   this->increaseEnergy(1000);
     85  this->setMaximumEnergy(100, 1);
     86  this->increaseEnergy(30);
    8787  //this->minCharge = 2;
    8888
     
    9090
    9191  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    92   this->setProjectileType(CL_LASER);
    93   this->prepareProjectiles(20);
     92  this->setProjectileType(CL_BOMB);
     93  this->prepareProjectiles(5);
    9494
    9595//  this->objectComponent1 = new PNode();
     
    163163  pj->setParent(NullParent::getInstance());
    164164
    165   pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*50+VECTOR_RAND(5));
     165  pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*15+VECTOR_RAND(5));
    166166
    167167  pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset for help on using the changeset viewer.