Changeset 10624 for code/trunk/src/orxonox/items
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/orxonox/items/ShipPart.cc
r10262 r10624 50 50 51 51 ShipPart::ShipPart(Context* context) 52 : Item(context) 52 : Item(context), parent_(NULL) 53 53 { 54 54 RegisterObject(ShipPart); 55 this->setAlive(true); 56 this->setEventExecution(true); 55 this->eventExecution_ = true; 57 56 this->healthMem_ = 100; 58 57 } … … 60 59 ShipPart::~ShipPart() 61 60 { 62 61 if (this->parent_) 62 { 63 // Remove this ShipPart from the parent. 64 this->parent_->removeShipPart(this); 65 } 63 66 } 64 67 … … 86 89 void ShipPart::death() 87 90 { 88 //if (!(this->isAlive()))89 //return;90 91 91 this->explode(); 92 this->setAlive(false);93 92 94 93 if(eventExecution_) … … 101 100 } 102 101 103 // Remove this ShipPart from the parent. 104 this->parent_->removeShipPart(this); 105 delete this; 102 this->destroyLater(); 106 103 } 107 104 … … 203 200 { 204 201 this->health_ = health; 205 }206 207 void ShipPart::setAlive(bool var)208 {209 this->alive_ = var;210 orxout() << "ShipPart " << this->getName() << " alive_: " << this->alive_ << endl;211 202 } 212 203 … … 240 231 } 241 232 if (this->health_ < 0) 242 this->alive_ = false; 243 //this->death(); 233 this->death(); 244 234 245 235 // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented. -
code/trunk/src/orxonox/items/ShipPart.h
r10262 r10624 72 72 { return this->parent_; } 73 73 74 void setAlive(bool var);75 inline bool isAlive()76 { return this->alive_; }77 78 74 inline void setEventExecution(bool var) 79 75 { this->eventExecution_ = var; } … … 121 117 std::vector<PartDestructionEvent*> eventList_; // The list of all PartDestructionEvent assigned to this ShipPart. 122 118 123 bool alive_;124 119 bool eventExecution_; 125 120
Note: See TracChangeset
for help on using the changeset viewer.