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/orxonox/interfaces/PickupCarrier.h

    r6540 r6607  
    4848{
    4949
    50     //! Pre-declarations.
    51     class Pickup;
    52     class HealthPickup;
    53     class MetaPickup;
    54 
    5550    /**
    5651    @brief
     
    6661        friend class HealthPickup;
    6762        friend class MetaPickup;
    68        
     63        friend class SpeedPickup;
     64
    6965        public:
    7066            PickupCarrier(); //!< Constructor.
    7167            virtual ~PickupCarrier(); //!< Destructor.
    72            
     68
    7369            /**
    7470            @brief Can be called to pick up a Pickupable.
     
    8682                    return pickedUp;
    8783                }
    88                
     84
    8985            /**
    9086            @brief Can be called to drop a Pickupable.
     
    9490            */
    9591            bool drop(Pickupable* pickup, bool drop = true)
    96                 { 
     92                {
    9793                    bool dropped = this->pickups_.erase(pickup) == 1;
    9894                    if(dropped && drop)
     
    10399                    return dropped;
    104100                }
    105                
     101
    106102            /**
    107103            @brief Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable.
     
    113109                    if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target.
    114110                        return true;
    115                    
     111
    116112                    //! Go recursively through all children to check whether they are a target.
    117113                    std::list<PickupCarrier*>* children = this->getCarrierChildren();
     
    121117                            return true;
    122118                    }
    123                    
     119
    124120                    children->clear();
    125121                    delete children;
    126                    
     122
    127123                    return false;
    128124                }
    129                
     125
    130126            /**
    131127            @brief Get the carrier that is both a child of the PickupCarrier (or the PickupCarrier itself) and a target of the input Pickupable.
     
    137133                    if(!this->isTarget(pickup))
    138134                        return NULL;
    139                    
     135
    140136                    if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target.
    141137                        return this;
    142                    
     138
    143139                    //! Go recursively through all children to check whether they are the target.
    144140                    std::list<PickupCarrier*>* children = this->getCarrierChildren();
     
    148144                            return *it;
    149145                    }
    150                    
     146
    151147                    children->clear();
    152148                    delete children;
    153                    
     149
    154150                    return NULL;
    155151                }
    156                
     152
    157153            /**
    158154            @brief Get the (absolute) position of the PickupCarrier.
     
    161157            */
    162158            virtual const Vector3& getCarrierPosition(void) = 0;
    163            
    164         protected:       
     159
     160        protected:
    165161            /**
    166162            @brief Get all direct children of this PickupSpawner.
    167163                   This method needs to be implemented by any direct derivative class of PickupCarrier.
    168164                   The returned list will be deleted by the methods calling this function.
    169             @return Returns a pointer to a list of all direct children. 
     165            @return Returns a pointer to a list of all direct children.
    170166            */
    171167            virtual std::list<PickupCarrier*>* getCarrierChildren(void) = 0;
     
    176172            */
    177173            virtual PickupCarrier* getCarrierParent(void) = 0;
    178                            
     174
    179175            /**
    180176            @brief Get all Pickupables this PickupCarrier has.
     
    183179            std::set<Pickupable*>& getPickups(void)
    184180                { return this->pickups_; }
    185        
     181
    186182        private:
    187183            std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier.
    188            
     184
    189185    };
    190186}
Note: See TracChangeset for help on using the changeset viewer.