Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 16, 2010, 12:37:09 PM (14 years ago)
Author:
dafrick
Message:

Documenting and cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/pickup/items/InvisiblePickup.cc

    r7546 r7547  
    3535
    3636#include <sstream>
    37 #include <OgreEntity.h>
    38 #include <OgreAnimationState.h>
    39 
    40 #include "util/StringUtils.h"
     37//#include <OgreEntity.h>
     38//#include <OgreAnimationState.h>
    4139#include "core/CoreIncludes.h"
    4240#include "core/XMLPort.h"
    4341
     42#include "pickup/PickupIdentifier.h"
    4443#include "worldentities/pawns/Pawn.h"
    45 #include "pickup/PickupIdentifier.h"
    4644
    4745namespace orxonox
     
    6866    }
    6967
    70 
     68    /**
     69    @brief
     70    Initializes the member variables.
     71    */
     72    void InvisiblePickup::initialize(void)
     73    {
     74        this->duration_ = 0.0f;
     75        // Defines who is allowed to pick up the pickup.
     76        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
     77    }
     78
     79    /**
     80    @brief
     81        Initializes the PickupIdentifier of this pickup.
     82    */
    7183    void InvisiblePickup::initializeIdentifier(void)
    7284    {
     
    8092    /**
    8193    @brief
    82     Initializes the member variables.
    83     */
    84     void InvisiblePickup::initialize(void)
    85     {
    86         this->duration_ = 0.0f;
    87         // Defines who is allowed to pick up the pickup.
    88         this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    89     }
    90 
    91     /**
    92     @brief
    9394        Method for creating a HealthPickup object through XML.
    9495    */
     
    113114            return;
    114115
     116        // If the pickup has transited to used.
    115117        if (this->isUsed())
    116118        {
     119            // If its durationType is continuous, we set a Timer to be reminded, when the time has run out.
    117120            if(this->isContinuous())
    118121            {
     
    134137            this->setInvisible(false);
    135138
     139            // We destroy the pickup if either, the pickup has activationType immediate and durationType once or it has durationType continuous and the duration was exceeded.
    136140            if((!this->isContinuous() && this->isImmediate()) || (this->isContinuous() && !this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration()))
    137141            {
    138142                this->Pickupable::destroy();
    139143            }
     144            // We pause the Timer if the pickup is continuous and the duration is not yet exceeded,
    140145            else if(this->isContinuous() && this->durationTimer_.isActive())
    141146            {
     
    143148            }
    144149        }
    145 
    146     }
    147 
    148     /**
    149     @brief
    150         Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    151     @return
    152         A pointer to the Pawn, or NULL if the conversion failed.
    153     */
    154     Pawn* InvisiblePickup::carrierToPawnHelper(void)
    155     {
    156         PickupCarrier* carrier = this->getCarrier();
    157         Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    158 
    159         if(pawn == NULL)
    160         {
    161             COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl;
    162         }
    163         return pawn;
    164150    }
    165151
     
    212198    /**
    213199    @brief
     200        Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
     201    @return
     202        A pointer to the Pawn, or NULL if the conversion failed.
     203    */
     204    Pawn* InvisiblePickup::carrierToPawnHelper(void)
     205    {
     206        PickupCarrier* carrier = this->getCarrier();
     207        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
     208
     209        if(pawn == NULL)
     210        {
     211            COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl;
     212        }
     213        return pawn;
     214    }
     215
     216    /**
     217    @brief
    214218        Sets the time the InvisibilityPickup will last.
    215219    @param duration
Note: See TracChangeset for help on using the changeset viewer.