Changeset 8454 for code/branches
- Timestamp:
- May 12, 2011, 1:17:38 PM (14 years ago)
- Location:
- code/branches/portals
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/portals/data/levels/portals.oxw
r8290 r8454 10 10 include("stats.oxo") 11 11 include("templates/spaceshipAssff.oxt") 12 include("templates/pickupRepresentationTemplates.oxt") 12 13 include("templates/lodInformation.oxt") 13 14 ?> … … 26 27 > 27 28 28 <Template name= portalDefault>29 <Template name=PortalDefault> 29 30 <PortalEndPoint> 30 31 <attached> 31 <Billboard material=" Examples/Flare" />32 <Billboard material="Portals/Default" /> 32 33 </attached> 33 34 </PortalEndPoint> 34 35 </Template> 35 36 36 <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design=" portalDefault" eventTemplate="portalEventTemplate"/>37 <PortalEndPoint position="- 400,0,0" id="2" distance="40" lookat="0,100,0" target="MobileEntity" design="portalDefault"/>37 <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/> 38 <PortalEndPoint position="-90,0,0" id="2" distance="40" target="MobileEntity" design="PortalDefault"/> 38 39 <PortalLink fromID="1" toID="2" /> 39 40 <PortalLink fromID="2" toID="1" /> 41 42 <PickupSpawner position="-100,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10"> 43 <pickup> 44 <DronePickup template=dronepickup /> 45 </pickup> 46 </PickupSpawner> 40 47 41 48 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/branches/portals/src/modules/portals/PortalEndPoint.cc
r8290 r8454 53 53 bool PortalEndPoint::execute(bool bTriggered, BaseObject* trigger) 54 54 { 55 if(!this->isActive()) 56 return true; 57 55 58 MultiTriggerContainer * cont = orxonox_cast<MultiTriggerContainer *>(trigger); 56 59 if(cont == 0) … … 64 67 } 65 68 66 if(this->getAttachedObjects().find(orxonox_cast<WorldEntity *>(originatingTrigger)) == this->getAttachedObjects().end()) // only necessary if events have the same name67 return true;68 69 69 MobileEntity * entity = orxonox_cast<MobileEntity *>(cont->getData()); 70 70 if(entity == 0) … … 73 73 if(bTriggered) 74 74 { 75 if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end()) // only enter the portal if not recentlyjumped out of it75 if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end()) // only enter the portal if not just jumped out of it 76 76 { 77 77 PortalLink::use(entity, this); … … 89 89 { 90 90 this->recentlyJumpedOut_.insert(entity); 91 91 92 entity->setPosition(this->getWorldPosition()); 92 93 entity->rotate(this->getWorldOrientation()); 93 94 entity->setVelocity(this->getWorldOrientation() * entity->getVelocity()); 95 entity->setVelocity(entity->getVelocity() * 1.5); 94 96 } 95 97 -
code/branches/portals/src/modules/portals/PortalEndPoint.h
r8290 r8454 21 21 virtual ~PortalEndPoint(); 22 22 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 23 inline void setTargets(const std::string & targets) 23 inline void setTargets(const std::string & targets) //!< set types which are allowed to activate the PortalEndPoint 24 24 { 25 25 this->trigger_->addTargets(targets); … … 27 27 28 28 void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); 29 static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< maps integer id values to portalendpoints29 static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint 30 30 inline void setID(unsigned int id) 31 31 { … … 37 37 return this->id_; 38 38 } 39 40 /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object 39 41 inline void setTemplate(const std::string & name) 40 42 { … … 42 44 this->addTemplate(name); 43 45 } 46 47 /// \brief Get the name of the attached design template 44 48 inline const std::string & getTemplate() 45 49 { 46 50 return this->templateName_; 47 51 } 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 */ 48 59 bool execute(bool bTriggered, BaseObject* trigger); 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 */ 49 63 void jumpOut(MobileEntity * entity); 50 64 protected: 51 65 52 66 private: 53 static const std::string EVENTFUNCTIONNAME; 67 static const std::string EVENTFUNCTIONNAME; //!< = "execute" 54 68 55 unsigned int id_; 56 DistanceMultiTrigger * trigger_; 57 std::string templateName_; 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 58 72 59 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
Note: See TracChangeset
for help on using the changeset viewer.