Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2011, 3:05:26 PM (13 years ago)
Author:
dafrick
Message:

Cleaning up game immersion. Roughly documenting weapons module.

File:
1 edited

Legend:

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

    r8706 r8855  
    2727 */
    2828
     29/**
     30    @file Projectile.h
     31    @brief Implementation of the Projectile class.
     32*/
     33
    2934#include "Projectile.h"
    3035
     36#include "core/ConfigValueIncludes.h"
    3137#include "core/CoreIncludes.h"
    32 #include "core/ConfigValueIncludes.h"
    3338#include "core/GameMode.h"
    3439#include "core/command/Executor.h"
     40
    3541#include "objects/collisionshapes/SphereCollisionShape.h"
    3642#include "worldentities/pawns/Pawn.h"
    37 #include "graphics/ParticleSpawner.h"
    3843
    3944namespace orxonox
     
    4651
    4752        this->setConfigValues();
    48         this->owner_ = 0;
    4953
    5054        // Get notification about collisions
    5155        if (GameMode::isMaster())
    5256        {
    53             this->setMass(1.0);
     57            this->setMass(1.0f);
    5458            this->enableCollisionCallback();
    5559            this->setCollisionResponse(false);
     
    5761
    5862            SphereCollisionShape* shape = new SphereCollisionShape(this);
    59             shape->setRadius(20);
     63            shape->setRadius(20.0f);
    6064            this->attachCollisionShape(shape);
    6165
    62             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Projectile::destroyObject, this)));
     66            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
    6367        }
    6468    }
     
    7074    void Projectile::setConfigValues()
    7175    {
    72         SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
     76        SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive");
    7377    }
    7478
     
    8185            return;
    8286
    83         if (this->getBDestroy())
    84             this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
     87        this->destroyCheck();
    8588    }
    8689
    87     void Projectile::destroyObject()
     90    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    8891    {
    89         if (GameMode::isMaster())
    90             this->destroy();
     92        return this->processCollision(otherObject, contactPoint);
    9193    }
    9294
    93     /* Calls the collidesAgainst function of BasicProjectile
    94      */
    95     bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    96     {
    97         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    98     }
    99 
    100     void Projectile::setOwner(Pawn* owner)
    101     {
    102         this->owner_ = owner;
    103     }
    10495}
Note: See TracChangeset for help on using the changeset viewer.