Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/portals/PortalEndPoint.h @ 9699

Last change on this file since 9699 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

  • Property svn:eol-style set to native
File size: 5.0 KB
RevLine 
[8706]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 *      Andreas Büchel
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30 *  @file PortalEndPoint.h
31 *  @brief Declaration of the PortalEndPoint class.
32 *  @ingroup Portals
33 */
34
[8177]35#ifndef _PortalEndPoint_H__
36#define _PortalEndPoint_H__
37
[8200]38#include "portals/PortalsPrereqs.h"
39
[8767]40#include <map>
[8177]41#include <set>
42#include <string>
43
[8767]44#include "core/EventIncludes.h"
45
[8200]46#include "worldentities/StaticEntity.h"
[8706]47#include "interfaces/RadarViewable.h"
[8200]48#include "objects/triggers/DistanceMultiTrigger.h"
[8177]49
50namespace orxonox
51{
[8706]52    /**
53     @brief
54     A PortalEndPoint serves as portal entrance and/or exit.
[8767]55
[8706]56     @ingroup Portals
57     */
[8767]58
[8706]59    class _PortalsExport PortalEndPoint : public StaticEntity, public RadarViewable
[8177]60    {
61        public:
[9667]62            PortalEndPoint(Context* context);
[8177]63            virtual ~PortalEndPoint();
[8767]64
[8177]65            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[8706]66            virtual void changedActivity(void);
[8767]67
[8457]68            inline void setTarget(const std::string & target)                 //!< add types which are allowed to activate the PortalEndPoint
[8706]69                { this->trigger_->addTarget(target); }
[8767]70
[8243]71            void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
[8454]72            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
[8706]73            inline void setReenterDelay(unsigned int seconds)
74                { this->reenterDelay_ = seconds; }
75            inline unsigned int getReenterDelay()
76                { return this->reenterDelay_; }
[8177]77            inline void setID(unsigned int id)
[8706]78                { this->id_ = id; }
[8767]79
[8177]80            inline unsigned int getID() const
[8706]81                { return this->id_; }
[8767]82
[8454]83            /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
[8243]84            inline void setTemplate(const std::string & name)
[8706]85                { this->templateName_ = name; this->addTemplate(name); }
[8454]86
87            /// \brief Get the name of the attached design template
[8243]88            inline const std::string & getTemplate()
[8706]89                { return this->templateName_; }
[8454]90
91            /*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
[8706]92                \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
93                \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
94            */
[8243]95            bool execute(bool bTriggered, BaseObject* trigger);
[8454]96
97            /*! \brief Let an Entity jump out of this portal no matter where it was before
98             * \param entity The Entity which should jump out of this portal */
[8243]99            void jumpOut(MobileEntity * entity);
[8767]100
[8706]101            /** \brief Tells wether a certain Entity is allowed to enter the PortalEndPoint?
102                @return @c true if the entity not just came out of this portal and the reenterDelay has expired for it, @c false otherwise
103            */
104            bool letsEnter(MobileEntity* entity);
[8177]105        protected:
[8767]106
[8177]107        private:
[8454]108            static const std::string EVENTFUNCTIONNAME; //!< = "execute"
[8767]109
[8454]110            unsigned int id_;            //!< the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links between PortalEndPoints
111            DistanceMultiTrigger * trigger_;      //!< the DistanceMultiTrigger which notices near entities of the defined type
112            std::string templateName_;            //!< The name of the design template used for this endpoint
[8290]113
[8706]114            int reenterDelay_;
115            std::map<MobileEntity *, time_t> jumpOutTimes_;   //!< Stores the time at which a certain MobileEntity @ref jumpOut "jumped out" of this PortalEndPoint
116            std::set<MobileEntity *> recentlyJumpedOut_;   //!< Stores the entities witch recently jumped out of this PortalEndPoint and haven't left the activation radius yet. This is needed in order to prevent them from beeing pulled into the PortalEndPoint they have just come out of.
[9526]117
118            WorldSound* portalSound_;
[8177]119    };
120
121}
122
123#endif /* _Portals_H__ */
Note: See TracBrowser for help on using the repository browser.