Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pickup/PickupCollection.h @ 6641

Last change on this file since 6641 was 6540, checked in by dafrick, 15 years ago

Removed some TODO's. Finished up documenting pickup module.

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file PickupCollection.h
31    @brief Declaration of PickupCollection.
32*/
33
34#ifndef _PickupCollection_H__
35#define _PickupCollection_H__
36
37#include "PickupPrereqs.h"
38
39#include "interfaces/Pickupable.h"
40#include "core/BaseObject.h"
41
42#include <list>
43
44namespace orxonox
45{
46
47    /**
48    @brief
49        The PickupCollection combines different Pickupables to a coherent, single pickup and makes the seem (from the outside looking in) just as if they were just one Pickupable.
50    @author
51        Damian 'Mozork' Frick
52    */
53    class _PickupExport PickupCollection : public Pickupable, public BaseObject
54    {
55       
56        public:
57           
58            PickupCollection(BaseObject* creator); //!< Default Constructor.
59            virtual ~PickupCollection(); //!< Destructor.
60           
61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates an instance of this Class through XML.
62
63            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
64            virtual void changedCarrier(void); //!< Is called when the pickup has changed its PickupCarrier.
65            virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around.
66           
67            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
68           
69            virtual bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
70           
71            virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection.
72           
73            bool addPickupable(Pickupable* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection.
74            const Pickupable* getPickupable(unsigned int index); //!< Get the Pickupable at the given index.
75           
76        protected:
77            void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup.
78           
79            virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
80           
81            PickupCollectionIdentifier* pickupCollectionIdentifier_; //!< The PickupCollectionIdentifier of this PickupCollection. Is used to distinguish different PickupCollections amongst themselves.
82           
83        private:
84           
85            std::vector<WeakPtr<Pickupable> > pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid.
86       
87    };
88   
89}
90
91#endif /* _PickupCollection_H__ */
Note: See TracBrowser for help on using the repository browser.