Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 10, 2015, 4:34:26 PM (9 years ago)
Author:
fvultier
Message:

Merged towerdefenseFabien branch back to trunk. The towerdefense Minigame is now a plugin.

Location:
code/trunk/src/modules/weapons/projectiles
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc

    r9667 r10629  
    8888    /**
    8989    @brief
     90        Get the material of the BillboardProjectile.
     91    @return
     92        The material name.
     93    */
     94    const std::string& BillboardProjectile::getMaterial()
     95    {
     96        return this->billboard_.getMaterial();
     97    }
     98
     99    /**
     100    @brief
    90101        Is called when the visibility of the BillboardProjectile has changed.
    91102    */
  • code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h

    r9667 r10629  
    6060            virtual void setColour(const ColourValue& colour);
    6161            virtual void setMaterial(const std::string& material);
     62            virtual const std::string& getMaterial();
    6263            virtual void changedVisibility();
    6364
  • code/trunk/src/modules/weapons/projectiles/CMakeLists.txt

    r10622 r10629  
    55  Projectile.cc
    66  LightningGunProjectile.cc
     7  SplitGunProjectile.cc
     8  IceGunProjectile.cc
    79  Rocket.cc
    810  RocketOld.cc
  • code/trunk/src/modules/weapons/projectiles/Projectile.cc

    r10287 r10629  
    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}
  • code/trunk/src/modules/weapons/projectiles/Projectile.h

    r10216 r10629  
    3939#include "tools/Timer.h"
    4040#include "worldentities/MovableEntity.h"
     41#include "objects/collisionshapes/SphereCollisionShape.h"
    4142
    4243#include "BasicProjectile.h"
     
    6667            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    6768
     69        protected:
     70            virtual void setCollisionShapeRadius(float radius);
     71
    6872        private:
    6973            float lifetime_; //!< The time the projectile exists.
    7074            Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
     75            WeakPtr<SphereCollisionShape> collisionShape_; // The collision shape of the projectile.           
    7176    };
    7277}
Note: See TracChangeset for help on using the changeset viewer.