- Timestamp:
- Nov 9, 2017, 6:13:50 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
r11551 r11553 50 50 - Neue Asteroiden generieren -> Absturz 51 51 - Pickup spawning -> Absturz 52 53 o hat's mit den Context-Eingenschaften zu tun? Je einen Neuen/Aktuellen besorgen? 54 55 Nicht Pointer uebergeben? 52 56 - Manchmal: Absturz bei Zerstoerung eines Asteroiden 57 - Was tut 'Register Variables'? 58 59 o Error messages: change context::pickups to something else 60 61 62 OFFEN: 63 o Add custom pickup 'resources' 53 64 54 65 … … 85 96 #include "../pickup/PickupSpawner.h" 86 97 #include "../pickup/Pickup.h" 98 //#include "../pickup/pickup ..... pickupable 87 99 #include "../objects/collisionshapes/SphereCollisionShape.h" 88 100 #include "../../orxonox/graphics/Model.h" … … 119 131 120 132 133 134 135 136 137 138 139 121 140 // DELETE if other stuff works! (wrong size etc.) 122 141 SphereCollisionShape* cs = new SphereCollisionShape(this->context); 123 142 cs->setRadius((this->size)*2); //OFFEN: Feinabstimmung der Radien 124 143 this->attachCollisionShape(cs); 144 145 125 146 126 147 … … 154 175 // Collision shape 155 176 SphereCollisionShape* cs = new SphereCollisionShape(this->context); 156 cs->setRadius((this->size)*2); //OFFEN: Feinabstimmung der Radien 177 cs->setRadius((this->size)*2); //OFFEN: Feinabstimmung der Radien. 2.5 in AsteroidField.lua 157 178 this->attachCollisionShape(cs); 158 159 179 160 180 … … 186 206 registerVariable(this->size, VariableDirection::ToClient); 187 207 registerVariable(this->generateSmaller, VariableDirection::ToClient); 208 209 registerVariable(this->initialised, VariableDirection::ToClient); 210 //registerVariable(this->context, VariableDirection::ToClient); // can't link that since it's a context 211 212 213 // float size; 214 // bool generateSmaller; 215 // bool initialised; 216 217 // Context* context; 188 218 } 189 219 … … 211 241 212 242 213 214 215 //Spawn Pickup 243 //Spawn Pickup // Create at start already? ( Hidden in CollisionShape) 216 244 HealthPickup* hP = new HealthPickup(this->context); 245 if(hP == nullptr){ 246 orxout(internal_error, context::pickups) << "Weird, can't create new HealthPickup." << endl; 247 } 248 // hP->setPosition(this->getPosition()); // Does not have a member named 'setPosition' (Inherits from Pickup//BAse Object) 249 250 // invoke spawnPickup on the pikcup itself? (returns bool, creates the hideous thing) 251 // HealthPickup inherits from Pickup. 252 // createSpawner is protected ->can be used as well in inheriting classes, but not here! 253 // bool unnecessary = hP->createSpawner(); 254 // hP->setPosition(this->getPosition()); 217 255 //OFFEN: Add custom pickup 'resources' 218 PickupSpawner* thingy = new PickupSpawner(this->context); 219 thingy->setPosition(this->getPosition()); 220 thingy->createDroppedPickup(this->context, hP, nullptr, 10); 221 256 257 // createPickup is private, hP is of type Pickup! 258 // CreateDroppedPickup returns a PickupSpawner! 259 // PickupSpawner don't have public set methods, just that ugly 'factory method' which returns another PickupSpawner 260 // PickupSpawner* thingy = new PickupSpawner(this->context); 261 // What is Pickupable? says: Interface, no way to set type. Why do I even need the spawner? Trigger Distance? 262 263 264 // Plan: Solve the Pickupable mystery, try to adapt the spawner somehow. Ask to modify it if that fails. (Change method types) 265 266 267 // PickupSpawner* thingy = (new PickupSpawner(this->context))->createDroppedPickup(this->context, hP, nullptr, 10); 222 268 // /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) 269 270 271 272 // if(thingy == nullptr){ 273 // orxout(internal_error, context::pickups) << "Weird, can't create new PickupSpawner." << endl; 274 // } 275 // thingy->setPosition(this->getPosition()); 276 // thingy->setMaxSpawnedItems(1);//Default is 1 already, private anyways 277 223 278 224 279 225 // Smaller Parts226 if(this->generateSmaller){227 this->spawnChildren();228 }280 // // Smaller Parts 281 // if(this->generateSmaller){ 282 // this->spawnChildren(); 283 // } 229 284 230 285 … … 271 326 //Spawn this child Game crashes! 272 327 AsteroidMinable* child = new AsteroidMinable(this->context); 273 child->setSize(extra + 1); 274 275 //OFFEN:Kollision der Kinder verhindern 276 //Relativ zu Elternteil automatisch? 277 //Typ position:rand()*Vektoriwas? 278 //pawn->getWorldPosition() + Vector3(30,0,-30); 279 child->setPosition(this->getPosition() + Vector3(num*5, 0, 0)); 328 // if(!(child == nullptr)){//Errorgebastel 329 330 331 332 if(child == nullptr){ 333 orxout(internal_error, context::pickups) << "Weird, can't create new AsteroidMinable." << endl; 334 } 335 336 child->setSize(extra + 1); 337 338 //OFFEN:Kollision der Kinder verhindern 339 //Relativ zu Elternteil automatisch? 340 //Typ position:rand()*Vektoriwas? 341 //pawn->getWorldPosition() + Vector3(30,0,-30); 342 child->setPosition(this->getPosition() + Vector3(num*5, 0, 0)); 343 344 // } 280 345 281 346
Note: See TracChangeset
for help on using the changeset viewer.