Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10606 for code


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.

Location:
code/branches/towerdefenseFabien
Files:
6 added
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/towerdefenseFabien/data/levels/towerDefense.oxw

    r10594 r10606  
    220220        </links>
    221221        <Weapon>
    222           <<HsW01 mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0,0,0" projectileMesh="LaserBeam2.mesh" />
     222          <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" 0,0,0" freezefactor=0.5 freezetime=2.0 />
    223223        </Weapon>
    224224      </WeaponPack>
  • code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefenseEnemy.h

    r10586 r10606  
    2222#include "worldentities/pawns/SpaceShip.h"
    2323#include "util/Output.h"
    24 #include "controllers/ArtificialController.h"
    2524#include "TowerDefense.h"
    2625
  • code/branches/towerdefenseFabien/src/modules/weapons/CMakeLists.txt

    r7163 r10606  
    22  MuzzleFlash.cc
    33  RocketController.cc
     4  IceGunFreezer.cc
    45)
    56
  • code/branches/towerdefenseFabien/src/modules/weapons/projectiles/CMakeLists.txt

    r10594 r10606  
    88  SimpleRocket.cc
    99  SplitGunProjectile.cc
     10  IceGunProjectile.cc
    1011)
  • 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}
  • code/branches/towerdefenseFabien/src/modules/weapons/projectiles/Projectile.h

    r10216 r10606  
    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}
  • code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc

    r10594 r10606  
    8686        {
    8787            this->splitTime_ = splitTime;
    88             this->textureTimer_.setTimer(this->splitTime_, false, createExecutor(createFunctor(&SplitGunProjectile::split, this)));
     88            this->splitTimer_.setTimer(this->splitTime_, false, createExecutor(createFunctor(&SplitGunProjectile::split, this)));
    8989        }
    9090        else
  • code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.h

    r10594 r10606  
    2828
    2929/**
    30     @file SplitGunProjectile.h
     30    @file IceGunProjectile.h
    3131    @brief Definition of the SplitGunProjectile class.
    3232*/
     
    6767            float splitTime_;
    6868            float spread_;
    69             Timer textureTimer_;
     69            Timer splitTimer_;
    7070
    7171            virtual void split();           
  • code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/CMakeLists.txt

    r10592 r10606  
    66  LightningGun.cc
    77  SplitGun.cc
     8  IceGun.cc
    89  RocketFire.cc
    910  SimpleRocketFire.cc
  • code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.cc

    r10594 r10606  
    2828
    2929/**
    30     @file SplitGun.h
     30    @file SplitGun.cc
    3131    @brief Implementation of the SplitGun class.
    3232*/
  • code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.h

    r10594 r10606  
    4343    /**
    4444    @brief
    45         A slow ball of lightning.
     45        A WeaponMode that fires projectiles that may split up into many other projectiles, that may again split up ...
    4646    @author
    4747        Fabien Vultier
Note: See TracChangeset for help on using the changeset viewer.