Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/wagnis_HS18/src/modules/wagnis/WagnisProvince.cc @ 12107

Last change on this file since 12107 was 12107, checked in by stadlero, 5 years ago

Province is now a pawn

File size: 2.7 KB
Line 
1#include "WagnisProvince.h"
2#include "core/CoreIncludes.h"
3#include "BulletDynamics/Dynamics/btRigidBody.h"
4#include "worldentities/StaticEntity.h"
5#include <vector>
6
7#define WAGNIS_PROVINCE_MAX_HEALTH 1000.0f
8
9/**TODO
10 *
11 *
12 *
13 **/
14
15namespace orxonox
16{
17    RegisterClass(WagnisProvince);
18
19    //Constructor
20    WagnisProvince::WagnisProvince(Context* context) : Pawn(context){
21        RegisterObject(WagnisProvince);
22        this->owner_ID = 0;
23        this->troops = 0;
24        this->ID = -1;
25        this->continent = -1;
26        this->neighbors = std::vector<WagnisProvince*>();
27        this->markerBillboard = nullptr;
28        this->maxHealth_ = WAGNIS_PROVINCE_MAX_HEALTH;
29        this->health_ = WAGNIS_PROVINCE_MAX_HEALTH-10.0f; // <-- DEBUG
30    }
31    //Destructor
32    WagnisProvince::~WagnisProvince(){
33
34    }
35
36    //Tick
37    void WagnisProvince::tick(float dt){
38        SUPER(WagnisProvince, tick, dt);
39
40        if(this->health_ < this->maxHealth_){
41            this->health_ = this->maxHealth_;
42            orxout() << "Health test ok" << endl;        }
43    }
44
45    //XML Port
46    void WagnisProvince::XMLPort(Element& xmlelement,XMLPort::Mode mode){
47        SUPER(WagnisProvince, XMLPort, xmlelement, mode);
48
49        XMLPortObject(WagnisProvince, Billboard, "MarkerBillboard", addMarkerBillboard, getMarkerBillboard, xmlelement, mode);
50        XMLPortParam(WagnisProvince, "ID", setID, getID, xmlelement, mode);
51        XMLPortParam(WagnisProvince, "continent", setContinent, getContinent, xmlelement, mode);
52    }
53
54    void WagnisProvince::addMarkerBillboard(Billboard* billi){
55        this->markerBillboard = billi;
56        attach(billi);
57    }
58    Billboard* WagnisProvince::getMarkerBillboard(unsigned int i) const{
59        if(i != 0) return nullptr;
60        return this->markerBillboard;
61    }
62
63
64
65
66    //SET()
67
68    //set owner_ID
69    void WagnisProvince::setOwner_ID(int owner){
70        this->owner_ID = owner;
71    }
72    //set troops
73    void WagnisProvince::setTroops(int troops){
74        this->troops = troops;
75    }
76    //set ID
77    void WagnisProvince::setID(int id){
78        this->ID = id;
79    }
80    //set Continent
81    void WagnisProvince::setContinent(int cont){
82        this->continent = cont;
83    }
84
85
86    //GET()
87
88    //get owner_ID
89    int WagnisProvince::getOwner_ID() const{
90        return this->owner_ID;
91    }
92    //get troops
93    int WagnisProvince::getTroops() const{
94        return this->troops;
95    }
96    //get ID
97    int WagnisProvince::getID() const{
98        return this->ID;
99    }
100    //get continent
101    int WagnisProvince::getContinent() const{
102        return this-> continent;
103    }
104
105    //Adds a connection to neighbors.
106    void WagnisProvince::addNeighbor(WagnisProvince* prov){
107        neighbors.push_back(prov);
108    }
109}
Note: See TracBrowser for help on using the repository browser.