Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 22, 2010, 10:45:09 PM (14 years ago)
Author:
ebeier
Message:

first working version of the SpeedPickup, needs some more work for "onUse" type. Spaceship trails need to be looked at, because they don't show when a SpeedPickup with SpeedAdd is used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ppspickups1/src/modules/pickup/Pickup.h

    r6540 r6607  
    4242#include "interfaces/Pickupable.h"
    4343
     44#include "tools/Timer.h"
     45
    4446namespace orxonox
    4547{
     
    5456        };
    5557    }
    56    
     58
    5759    //! Enum for the duration tyoe.
    5860    namespace pickupDurationType
     
    6466        };
    6567    }
    66    
     68
    6769    /**
    6870    @brief
     
    7476    class _PickupExport Pickup : public Pickupable, public BaseObject
    7577    {
    76        
     78
    7779        protected:
    7880            Pickup(BaseObject* creator); //!< Constructor.
    79        
     81
    8082        public:
    8183            virtual ~Pickup(); //!< Destructor.
    82            
     84
    8385            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    84            
     86
    8587            /**
    8688            @brief Get the activation type of the pickup.
     
    9597            inline pickupDurationType::Value getDurationTypeDirect(void)
    9698                { return this->durationType_; }
    97            
     99
    98100            const std::string& getActivationType(void); //!< Get the activation type of the pickup.
    99101            const std::string& getDurationType(void); //!< Get the duration type of the pickup.
    100            
     102
    101103            /**
    102104            @brief Get whether the activation type is 'immediate'.
     
    123125            inline bool isContinuous(void)
    124126                { return this->getDurationTypeDirect() == pickupDurationType::continuous; }
    125            
     127
    126128            virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
    127                                    
     129
    128130            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the Pickup.
    129                
     131
    130132        protected:
    131133            void initializeIdentifier(void);
    132            
     134
    133135            virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    134            
     136
     137            bool startPickupTimer(float durationTime);
     138
     139            virtual void PickupTimerCallBack(void) {}
     140
    135141            /**
    136142            @brief Set the activation type of the pickup.
     
    145151            inline void setDurationTypeDirect(pickupDurationType::Value type)
    146152                { this->durationType_ = type; }
    147                
     153
    148154            void setActivationType(const std::string& type); //!< Set the activation type of the pickup.
    149155            void setDurationType(const std::string& type); //!< Set the duration type of the pickup
    150                
     156
    151157        private:
    152158            void initialize(void); //!< Initializes the member variables.
    153            
     159
    154160            pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
    155161            pickupDurationType::Value durationType_; //!< The duration type of the pickup.
    156            
     162
    157163            static const std::string activationTypeImmediate_s;
    158164            static const std::string activationTypeOnUse_s;
    159165            static const std::string durationTypeOnce_s;
    160166            static const std::string durationTypeContinuous_s;
    161        
     167
     168            float durationTime_;
     169            Timer durationTimer_;
    162170    };
    163    
     171
    164172}
    165173#endif // _Pickup_H__
Note: See TracChangeset for help on using the changeset viewer.