Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/portals/src/modules/portals/PortalEndPoint.h @ 8454

Last change on this file since 8454 was 8454, checked in by anbueche, 13 years ago

comments added

  • Property svn:executable set to *
File size: 3.4 KB
RevLine 
[8177]1#ifndef _PortalEndPoint_H__
2#define _PortalEndPoint_H__
3
[8200]4#include "portals/PortalsPrereqs.h"
5
[8177]6#include <set>
7#include <string>
8#include <map>
9
[8200]10#include "worldentities/StaticEntity.h"
[8177]11#include "graphics/Billboard.h"
[8200]12#include "objects/triggers/DistanceMultiTrigger.h"
[8243]13#include "core/EventIncludes.h"
[8177]14
15namespace orxonox
16{
[8243]17    class _PortalsExport PortalEndPoint : public StaticEntity
[8177]18    {
19        public:
20            PortalEndPoint(BaseObject* creator);
21            virtual ~PortalEndPoint();
22            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[8454]23            inline void setTargets(const std::string & targets)                 //!< set types which are allowed to activate the PortalEndPoint
[8243]24            {
25                this->trigger_->addTargets(targets);
26            }
27           
28            void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
[8454]29            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
[8177]30            inline void setID(unsigned int id)
31            {
32                this->id_ = id;
33            }
34           
35            inline unsigned int getID() const
36            {
37                return this->id_;
38            }
[8454]39           
40            /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
[8243]41            inline void setTemplate(const std::string & name)
42            {
43                this->templateName_ = name;
44                this->addTemplate(name);
45            }
[8454]46
47            /// \brief Get the name of the attached design template
[8243]48            inline const std::string & getTemplate()
49            {
50                return this->templateName_;
51            }
[8454]52
53            /*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
54             * \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
55             * \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
56             *
57             * if bTriggered is \c true the triggering entity enters this portal (if it is an entrance)
58             * otherwise the triggering entity is removed from the set of entities who recently jumped out of this portal */
[8243]59            bool execute(bool bTriggered, BaseObject* trigger);
[8454]60
61            /*! \brief Let an Entity jump out of this portal no matter where it was before
62             * \param entity The Entity which should jump out of this portal */
[8243]63            void jumpOut(MobileEntity * entity);
[8177]64        protected:
[8290]65           
[8177]66        private:
[8454]67            static const std::string EVENTFUNCTIONNAME; //!< = "execute"
[8290]68           
[8454]69            unsigned int id_;            //!< the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links between PortalEndPoints
70            DistanceMultiTrigger * trigger_;      //!< the DistanceMultiTrigger which notices near entities of the defined type
71            std::string templateName_;            //!< The name of the design template used for this endpoint
[8290]72
[8243]73            std::set<MobileEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
[8177]74    };
75
76}
77
78#endif /* _Portals_H__ */
Note: See TracBrowser for help on using the repository browser.