Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4927 in orxonox.OLD


Ignore:
Timestamp:
Jul 21, 2005, 5:33:20 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some smaller fixes, to make Weapon more local

Location:
orxonox/trunk/src/world_entities/weapons
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapons/projectile.cc

    r4890 r4927  
    6161   tick function
    6262*/
    63 void Projectile::setFlightDirection(Quaternion flightDirection)
     63void Projectile::setFlightDirection(const Quaternion& flightDirection)
    6464{
    6565  Vector v(1, 0, 0);
     
    7979}
    8080
    81 
    8281/**
    83  *  signal tick, time dependent things will be handled here
     82 * signal tick, time dependent things will be handled here
    8483 * @param time since last tick
    8584*/
  • orxonox/trunk/src/world_entities/weapons/projectile.h

    r4890 r4927  
    3434    virtual ~Projectile ();
    3535
    36     void setFlightDirection(Quaternion flightDirection);
     36    void setFlightDirection(const Quaternion& flightDirection);
    3737    void setVelocity(const Vector &velocity);
    3838    void setLifeSpan(float lifeSpan);
     
    5454
    5555    float                 lifeCycle;                 //!< The percentage of the Lifetime done [0-1]
    56     float                 lifeSpan;                  //!< The entire lifespan of the Shoot.
     56    float                 lifeSpan;                  //!< The entire lifespan of the Shoot. in seconds
    5757
    5858    Vector                flightDirection;           //!< direction in which the shoot flighs
  • orxonox/trunk/src/world_entities/weapons/test_gun.cc

    r4910 r4927  
    6464  if( this->leftRight == W_LEFT)
    6565    {
    66       this->projectileOffset = Vector(1.0, 0.0, -0.35);
     66      this->setEmissionPoint(1.0, 0.0, -0.35);
    6767
    6868      animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     
    7878  else if( this->leftRight == W_RIGHT)
    7979    {
    80       this->projectileOffset = Vector(1.0, 0.0, 0.5);
     80      this->setEmissionPoint(1.0, 0.0, 0.5);
    8181
    8282      this->objectComponent1->setRelCoor(Vector(0,0,0.35));
     
    105105  this->setStateDuration(WS_DEACTIVATING, .4);
    106106
    107   this->energy = 100;
    108   this->minCharge = 2;
     107  this->increaseEnergy(100);
     108  //this->minCharge = 2;
    109109
    110110  this->setActionSound(WA_SHOOT, "sound/shot1.wav");
     
    156156//  weaponSource->play();
    157157
    158   pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
     158  pj->setAbsCoor(this->getEmissionPoint());
    159159  pj->setAbsDir(this->getAbsDir());
    160160  pj->setVelocity(this->getVelocity());
  • orxonox/trunk/src/world_entities/weapons/test_gun.h

    r4895 r4927  
    5252    PNode* objectComponent3;
    5353
    54     Vector projectileOffset;
    5554    int leftRight;   // this will become an enum
    5655
  • orxonox/trunk/src/world_entities/weapons/weapon.cc

    r4926 r4927  
    8686  this->minCharge = 1.0;
    8787  this->maxCharge = 1.0;
     88
    8889  this->energyLoaded = .0;
    8990  this->energyLoadedMax = 10.0;
     
    248249}
    249250
    250 
    251251/**
    252252 * checks and activates the Weapon.
     
    268268}
    269269
    270 
    271270/**
    272271 * checks and deactivates the Weapon
     
    308307    this->requestAction(WA_RELOAD);
    309308  }
    310 
    311309}
    312310
     
    370368}
    371369
    372 
    373370/**
    374371 * enters the requested State, plays back animations updates the timing.
     
    386383
    387384
     385
     386///////////////////
     387//  WORLD-ENTITY //
     388// FUNCTIONALITY //
     389///////////////////
    388390/**
    389391 * tick signal for time dependent/driven stuff
  • orxonox/trunk/src/world_entities/weapons/weapon.h

    r4926 r4927  
    9595    /** @see void setEmissionPoint(const Vector& point); */
    9696    inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x,y,z)); };
     97    /** @returns the absolute Position of the EmissionPoint */
     98    inline const Vector& getEmissionPoint() const { return this->emissionPoint.getAbsCoor(); };
    9799
    98100    /** @param state the State to time @param duration the duration of the State */
     
    158160
    159161
    160   protected:
     162  private:
    161163    // it is all about energy
    162164    float                energy;                           //!< The energy stored in the weapons secondary buffers (reserve)
     
    171173    // PHASES //
    172174    ////////////
    173   private:
    174175    SoundSource*         soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
    175176
Note: See TracChangeset for help on using the changeset viewer.