Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc @ 8198

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

First steps to use of Triggers and Events

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#include "PortalEndPoint.h"
2#include "core/XMLPort.h"
3
4namespace 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        {
29            PortalEndPoint::idMap_s[this->id_] = this;
30        }
31    }
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
54}
Note: See TracBrowser for help on using the repository browser.