Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 2, 2015, 10:46:40 PM (9 years ago)
Author:
fvultier
Message:

The most expensive tower fires now a new weapon: The Ice gun; a weapon that slows down a hit SpaceShip. This weapon may be used outside the tower defense minigame.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseFabien/src/modules/weapons/projectiles/Projectile.cc

    r10287 r10606  
    3939#include "core/command/Executor.h"
    4040
    41 #include "objects/collisionshapes/SphereCollisionShape.h"
    4241#include "worldentities/pawns/Pawn.h"
    4342
     
    6059            this->setCollisionType(Dynamic);
    6160
    62             SphereCollisionShape* shape = new SphereCollisionShape(this->getContext());
    63             shape->setRadius(20.0f);
    64             this->attachCollisionShape(shape);
     61            // Create a sphere collision shape and attach it to the projectile.
     62            collisionShape_ = new SphereCollisionShape(this->getContext());
     63            setCollisionShapeRadius(20.0f);
     64            this->attachCollisionShape(collisionShape_);
    6565
    6666            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
     
    7676        SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive");
    7777    }
    78 
    7978
    8079    void Projectile::tick(float dt)
     
    9392    }
    9493
     94    void Projectile::setCollisionShapeRadius(float radius)
     95    {
     96        if (collisionShape_ != NULL && radius > 0)
     97        {
     98            collisionShape_->setRadius(radius);
     99        }       
     100    }
    95101}
Note: See TracChangeset for help on using the changeset viewer.