Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 24, 2010, 9:49:54 AM (14 years ago)
Author:
dafrick
Message:

Removed Timer from Pickup, as this is no his core functionality.

Location:
code/trunk/src/modules/pickup/items
Files:
6 edited

Legend:

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

    r7163 r7208  
    115115        if (this->isUsed())
    116116        {
    117             if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() > 0.0f)
    118             {
    119                 this->getTimer()->unpauseTimer();
     117            if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
     118            {
     119                this->durationTimer_.unpauseTimer();
    120120            }
    121121            else
    122122            {
    123                 this->startPickupTimer(this->getDuration());
     123                this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&InvisiblePickup::pickupTimerCallback, this)));
    124124            }
    125125
     
    131131            this->setInvisible(false);
    132132
    133             if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration())
     133            if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration())
    134134            {
    135135                this->Pickupable::destroy();
     
    137137            else
    138138            {
    139                 this->getTimer()->pauseTimer();
     139                this->durationTimer_.pauseTimer();
    140140            }
    141141        }
  • code/trunk/src/modules/pickup/items/InvisiblePickup.h

    r7163 r7208  
    7777            void setDuration(float duration);
    7878            void initializeIdentifier(void);
    79             virtual void pickupTimerCallback(void); //!< Function that gets called when the timer ends.
     79            void pickupTimerCallback(void); //!< Function that gets called when the timer ends.
    8080
    8181        private:
    8282            void initialize(void); //!< Initializes the member variables.
    8383            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
     84
     85            Timer durationTimer_; //!< Timer.
     86
    8487            bool invisible_; //!< Helper to remember wether the Pawn is invisible.
    8588            float duration_; //! Duration of invisibility.
  • code/trunk/src/modules/pickup/items/ShieldPickup.cc

    r7163 r7208  
    160160        if(this->isUsed())
    161161        {
    162             if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() > 0.0f)
     162            if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
    163163            {
    164                 this->getTimer()->unpauseTimer();
     164                this->durationTimer_.unpauseTimer();
    165165            }
    166166            else
    167167            {
    168                 this->startPickupTimer(this->getDuration());
     168                this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&ShieldPickup::pickupTimerCallback, this)));
    169169            }
    170170            pawn->setShieldAbsorption(this->getShieldAbsorption());
     
    179179            if(this->isOnce())
    180180            {
    181                 if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration())
     181                if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration())
    182182                {
    183183                    this->Pickupable::destroy();
     
    185185                else
    186186                {
    187                     this->getTimer()->pauseTimer();
     187                    this->durationTimer_.pauseTimer();
    188188                }
    189189            }
  • code/trunk/src/modules/pickup/items/ShieldPickup.h

    r7163 r7208  
    8080            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    8181
    82             virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends.
     82            void pickupTimerCallback(void); //!< Function that gets called when timer ends.
    8383
    8484            void setDuration(float duration);
     
    9090            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    9191
     92            Timer durationTimer_; //!< Timer.
     93
    9294            float duration_; //!< The health that is transferred to the Pawn.
    9395            float shieldHealth_;
  • code/trunk/src/modules/pickup/items/SpeedPickup.cc

    r7163 r7208  
    141141        if(this->isUsed())
    142142        {
    143             if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() > 0.0f)
     143            if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() > 0.0f)
    144144            {
    145                 this->getTimer()->unpauseTimer();
     145                this->durationTimer_.unpauseTimer();
    146146            }
    147147            else
    148148            {
    149                 this->startPickupTimer(this->getDuration());
     149                this->durationTimer_.setTimer(this->getDuration(), false, createExecutor(createFunctor(&SpeedPickup::pickupTimerCallback, this)));
    150150            }
    151151            engine->setSpeedAdd(this->getSpeedAdd());
     
    159159            if(this->isOnce())
    160160            {
    161                 if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration())
     161                if(!this->durationTimer_.isActive() && this->durationTimer_.getRemainingTime() == this->getDuration())
    162162                {
    163163                    this->Pickupable::destroy();
     
    165165                else
    166166                {
    167                     this->getTimer()->pauseTimer();
     167                    this->durationTimer_.pauseTimer();
    168168                }
    169169            }
  • code/trunk/src/modules/pickup/items/SpeedPickup.h

    r7163 r7208  
    7979            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    8080
    81             virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends.
     81            void pickupTimerCallback(void); //!< Function that gets called when timer ends.
    8282
    8383            void setDuration(float duration);
     
    8989            Engine* carrierToEngineHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    9090
     91            Timer durationTimer_; //!< Timer.
     92
    9193            float duration_; //!< The health that is transferred to the Pawn.
    9294            float speedAdd_;
Note: See TracChangeset for help on using the changeset viewer.