Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2008, 4:25:52 AM (16 years ago)
Author:
landauf
Message:

merged core3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/Projectile.cc

    r1602 r1747  
    3535#include "core/Executor.h"
    3636#include "core/ConfigValueIncludes.h"
     37#include "core/Iterator.h"
    3738#include "tools/ParticleInterface.h"
    3839
     
    4344namespace orxonox
    4445{
    45     float Projectile::speed_ = 5000;
     46    float Projectile::speed_s = 5000;
    4647
    4748    Projectile::Projectile(SpaceShip* owner) : owner_(owner)
     
    7374        SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
    7475        SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
    75         SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second");
     76        SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);
     77    }
    7678
    77         if(this->owner_)
    78           this->setVelocity(this->owner_->getInitialDir() * this->speed_);
     79    void Projectile::speedChanged()
     80    {
     81        Projectile::speed_s = this->speed_;
     82        if (this->owner_)
     83            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
    7984    }
    8085
    8186    void Projectile::tick(float dt)
    8287    {
    83         WorldEntity::tick(dt);
     88        SUPER(Projectile, tick, dt);
    8489
    8590        if (!this->isActive())
     
    8792
    8893        float radius;
    89         for (Iterator<Model> it = ObjectList<Model>::start(); it; ++it)
     94        for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it)
    9095        {
    9196            if ((*it) != this->owner_)
    9297            {
    93                 radius = it->getScale().x * 3.0;
     98                radius = it->getScale3D().x * 3.0;
    9499
    95100                if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius))
Note: See TracChangeset for help on using the changeset viewer.