Changeset 11736 for code/branches/Presentation_HS17_merge/src/modules/asteroidmining/SpicedAsteroidField.cc
- Timestamp:
- Feb 11, 2018, 10:31:46 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/asteroidmining/SpicedAsteroidField.cc
r11735 r11736 40 40 41 41 42 #include "../../orxonox/worldentities/pawns/Pawn.h"43 #include "../../orxonox/worldentities/WorldEntity.h"44 45 42 #include "SpicedAsteroidField.h" 46 43 #include "AsteroidMinable.h" … … 49 46 50 47 #include "core/CoreIncludes.h" 51 #include "core/GameMode.h"52 48 #include "core/XMLPort.h" 53 #include "core/EventIncludes.h"54 #include "network/NetworkFunction.h"55 49 #include "util/Math.h" 56 50 57 #include " ../../orxonox/graphics/Billboard.h"51 #include "graphics/Billboard.h" 58 52 59 53 … … 62 56 RegisterClass(SpicedAsteroidField); 63 57 64 SpicedAsteroidField::SpicedAsteroidField(Context* context) : Pawn(context) {58 SpicedAsteroidField::SpicedAsteroidField(Context* context) : BaseObject(context) { 65 59 66 60 RegisterObject(SpicedAsteroidField); 67 this->context = context;68 61 69 62 // Default Values: … … 76 69 this->foggy = true; 77 70 this->fogDensity = 0.5; 78 79 this->registerVariables();80 71 } 81 82 SpicedAsteroidField::SpicedAsteroidField(Context* c, Vector3 p, int minS, int maxS, int w, int count, bool f, float mD, float fD): Pawn(c){83 84 this->context = c;85 this->position = p;86 this->minSize = minS;87 this->maxSize = maxS;88 this->radius = w;89 this->count = count;90 this->foggy = f;91 92 this->mDensity = mD;93 this->fogDensity = fD;94 95 }96 97 72 98 73 SpicedAsteroidField::~SpicedAsteroidField(){ … … 109 84 for(int gertrud = 0; gertrud<count; ++gertrud){ 110 85 111 AsteroidMinable* a = new AsteroidMinable(this-> context);86 AsteroidMinable* a = new AsteroidMinable(this->getContext()); 112 87 113 88 size = round(rnd()*(this->maxSize - this->minSize)) + this->minSize; … … 121 96 122 97 bool spiced = (rnd() < (this->mDensity)); // Whether the asteroid does drop pickups etc. 123 a->toggleDropStuff(spiced); 124 125 a->setVelocity(this->getVelocity()); 98 a->setDropStuff(spiced); 126 99 127 100 // Fog is iplemented with billboards (as in asteroidField.lua, that bloke had the idea) 128 101 if(this->foggy && mod(gertrud, 5) == 0){ 129 Billboard* bb = new Billboard(this-> context);102 Billboard* bb = new Billboard(this->getContext()); 130 103 bb->setPosition(this->position + relPos); 131 104 bb->setMaterial("Smoke/Smoke"); … … 151 124 } 152 125 153 154 void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode){155 156 }157 158 void SpicedAsteroidField::registerVariables(){159 160 registerVariable(this->count, VariableDirection::ToClient);161 registerVariable(this->mDensity, VariableDirection::ToClient);162 registerVariable(this->position, VariableDirection::ToClient);163 registerVariable(this->maxSize, VariableDirection::ToClient);164 registerVariable(this->minSize, VariableDirection::ToClient);165 registerVariable(this->radius, VariableDirection::ToClient);166 registerVariable(this->foggy, VariableDirection::ToClient);167 registerVariable(this->fogDensity, VariableDirection::ToClient);168 169 }170 171 126 void SpicedAsteroidField::tick(float dt){ 172 127 173 128 this->create(); 174 this->bAlive_ = false;175 129 this->destroyLater(); 176 130 }
Note: See TracChangeset
for help on using the changeset viewer.