[8177] | 1 | #include "PortalEndPoint.h" |
---|
| 2 | #include "core/XMLPort.h" |
---|
| 3 | |
---|
| 4 | namespace orxonox |
---|
| 5 | { |
---|
| 6 | CreateFactory(PortalEndPoint); |
---|
| 7 | |
---|
| 8 | std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s; |
---|
| 9 | |
---|
| 10 | PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), material_(""), billboard_(0) |
---|
| 11 | { |
---|
| 12 | RegisterObject(PortalEndPoint); |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | PortalEndPoint::~PortalEndPoint() |
---|
| 16 | { |
---|
| 17 | |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | void PortalEndPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 21 | { |
---|
| 22 | SUPER(PortalEndPoint, XMLPort, xmlelement, mode); |
---|
| 23 | XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode); |
---|
| 24 | XMLPortParamExtern(PortalEndPoint, Billboard, this->billboard_, "material", setMaterial, getMaterial, xmlelement, mode); |
---|
| 25 | XMLPortParamExtern(PortalEndPoint, Billboard, this->billboard_, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White); |
---|
| 26 | |
---|
| 27 | if(mode == XMLPort::LoadObject) |
---|
| 28 | { |
---|
[8198] | 29 | PortalEndPoint::idMap_s[this->id_] = this; |
---|
[8177] | 30 | } |
---|
| 31 | } |
---|
[8198] | 32 | |
---|
| 33 | void PortalEndPoint::tick(float dt) |
---|
| 34 | { |
---|
| 35 | SUPER(PortalEndPoint, tick); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | void PortalEndPoint::jumpOut(WorldEntity* entity) |
---|
| 39 | { |
---|
| 40 | this->recentlyJumpedOut_.insert(entity); |
---|
| 41 | entity->setPosition(this->getPosition()); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | bool PortalEndPoint::hasRecentlyJumpedOut(WorldEntity* entity) |
---|
| 45 | { |
---|
| 46 | if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end()) |
---|
| 47 | { |
---|
| 48 | return false; |
---|
| 49 | } |
---|
| 50 | else |
---|
| 51 | return true; |
---|
| 52 | } |
---|
| 53 | |
---|
[8177] | 54 | } |
---|