Changeset 12086
- Timestamp:
- Nov 7, 2018, 11:26:02 AM (6 years ago)
- Location:
- code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxy.cc
r12064 r12086 205 205 void TixyTaxyTorxy::upgradeTower(int x, int y) 206 206 { 207 TixyTaxyTorxyCoordinate* coord = new TixyTaxyTorxyCoordinate(x,y);208 x = coord->GetX();209 y = coord->GetY();210 211 int cost = center_->getTowerCost(fields_[x][y]->getUpgrade() + 1);212 213 if (fields_[x][y]->isFree() == false && fields_[x][y]->canUpgrade() == true && getCredit() >= cost)214 {215 payCredit(cost);216 fields_[x][y]->upgrade();217 }207 // TixyTaxyTorxyCoordinate* coord = new TixyTaxyTorxyCoordinate(x,y); 208 // x = coord->GetX(); 209 // y = coord->GetY(); 210 211 // int cost = 100; 212 213 // if (fields_[x][y]->isFree() == false && fields_[x][y]->canUpgrade() == true && getCredit() >= cost) 214 // { 215 // payCredit(cost); 216 // fields_[x][y]->upgrade(); 217 // } 218 218 } 219 219 … … 234 234 selecter->buildTower_ = false; 235 235 236 if (getField(selecter->selectedPos_)->canUpgrade() == true) 237 { 238 upgradeTower(selecter->selectedPos_->GetX(), selecter->selectedPos_->GetY()); 239 } 240 else 241 { 242 addTower(selecter->selectedPos_->GetX(), selecter->selectedPos_->GetY()); 243 } 236 // if (getField(selecter->selectedPos_)->canUpgrade() == true) 237 // { 238 // upgradeTower(selecter->selectedPos_->GetX(), selecter->selectedPos_->GetY()); 239 // } 240 241 addTower(selecter->selectedPos_->GetX(), selecter->selectedPos_->GetY()); 242 244 243 } 245 244 -
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.cc
r12064 r12086 42 42 { 43 43 RegisterClass(TixyTaxyTorxyField); 44 44 int counter=0; 45 45 /** 46 46 @brief … … 86 86 } 87 87 88 void TixyTaxyTorxyField::upgrade()89 {90 if (canUpgrade() == true)91 {92 destroyTower();93 createTower(getUpgrade() + 1);94 }95 }96 97 int TixyTaxyTorxyField::getUpgrade()98 {99 return upgrade_;100 }101 102 TixyTaxyTorxyFieldType TixyTaxyTorxyField::getType()103 {104 return type_;105 }88 // void TixyTaxyTorxyField::upgrade() 89 // { 90 // if (canUpgrade() == true) 91 // { 92 // destroyTower(); 93 // createTower(getUpgrade() + 1); 94 // } 95 // } 96 97 // int TixyTaxyTorxyField::getUpgrade() 98 // { 99 // return upgrade_; 100 // } 101 102 // TixyTaxyTorxyFieldType TixyTaxyTorxyField::getType() 103 // { 104 // return type_; 105 // } 106 106 107 107 void TixyTaxyTorxyField::setUpgrade(int upgrade) 108 108 { 109 if (upgrade < 0) 110 { 111 upgrade_ = 0; 112 } 113 else if (upgrade > 5) 114 { 115 upgrade = 5; 116 } 117 else 118 { 119 upgrade_ = upgrade; 120 } 121 } 122 123 bool TixyTaxyTorxyField::canUpgrade() 124 { 125 if (tower_ != nullptr && upgrade_ < 5) 126 { 127 return true; 128 } 129 130 return false; 131 } 109 // upgrade_= counter%2; 110 // if (upgrade < 0) 111 // { 112 // upgrade_ = 0; 113 // } 114 // else if (upgrade > 5) 115 // { 116 // upgrade = 5; 117 // } 118 // else 119 // { 120 // upgrade_ = upgrade; 121 } 122 123 124 // } 125 126 // bool TixyTaxyTorxyField::canUpgrade() 127 // { 128 // if (tower_ != nullptr && upgrade_ < 5) 129 // { 130 // return true; 131 // } 132 133 // return false; 134 // } 132 135 133 136 void TixyTaxyTorxyField::setAngle(int newAngle) … … 253 256 void TixyTaxyTorxyField::createTower(int upgrade) 254 257 { 258 counter++; 255 259 if (tower_ == nullptr) 256 260 { 257 modelGround_->setMeshSource("TD_F1.mesh"); 261 if(counter%2==0){ 262 modelGround_->setMeshSource("TD_T1.mesh"); 258 263 tower_ = new TixyTaxyTorxyTower(center_->getContext()); 259 264 attach(tower_); 260 type_ = TixyTaxyTorxyFieldType::TOWER; 261 setUpgrade(upgrade); 262 if (upgrade_ > 0 && modelObject_ != nullptr) 263 { 264 switch (upgrade_) 265 { 266 case 1: 267 modelObject_->setMeshSource("TD_T1.mesh"); 268 tower_->addTemplate(center_->getTower1Template()); 269 break; 270 case 2: 271 modelObject_->setMeshSource("TD_T2.mesh"); 272 tower_->addTemplate(center_->getTower2Template()); 273 break; 274 case 3: 275 modelObject_->setMeshSource("TD_T3.mesh"); 276 tower_->addTemplate(center_->getTower3Template()); 277 break; 278 case 4: 279 modelObject_->setMeshSource("TD_T4.mesh"); 280 tower_->addTemplate(center_->getTower4Template()); 281 break; 282 case 5: 283 modelObject_->setMeshSource("TD_T5.mesh"); 284 tower_->addTemplate(center_->getTower5Template()); 285 break; 286 } 287 } 265 266 }else{ 267 modelGround_->setMeshSource("TD_T2.mesh"); 268 tower_ = new TixyTaxyTorxyTower(center_->getContext()); 269 attach(tower_); 270 } 271 272 273 // type_ = TixyTaxyTorxyFieldType::TOWER; 274 // setUpgrade(upgrade); 275 // if (upgrade_ > 0 && modelObject_ != nullptr) 276 // { 277 // modelObject_->setMeshSource("TD_T2.mesh"); 278 // tower_->addTemplate(center_->getTower1Template()); 279 // switch (counter%2 +1) 280 // { 281 // case 1: 282 // modelObject_->setMeshSource("TD_T1.mesh"); 283 // tower_->addTemplate(center_->getTower1Template()); 284 // break; 285 // case 2: 286 // modelObject_->setMeshSource("TD_T2.mesh"); 287 // tower_->addTemplate(center_->getTower2Template()); 288 // break; 289 // case 3: 290 // modelObject_->setMeshSource("TD_T3.mesh"); 291 // tower_->addTemplate(center_->getTower3Template()); 292 // break; 293 // case 4: 294 // modelObject_->setMeshSource("TD_T4.mesh"); 295 // tower_->addTemplate(center_->getTower4Template()); 296 // break; 297 // case 5: 298 // modelObject_->setMeshSource("TD_T5.mesh"); 299 // tower_->addTemplate(center_->getTower5Template()); 300 // break; 301 // } 302 // } 288 303 } 289 304 } -
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyField.h
r12064 r12086 68 68 virtual void create(char object, char param); 69 69 virtual void setCenterpoint(TixyTaxyTorxyCenterpoint* center); 70 virtual void upgrade();71 virtual int getUpgrade();72 virtual TixyTaxyTorxyFieldType getType();70 // virtual void upgrade(); 71 // virtual int getUpgrade(); 72 // virtual TixyTaxyTorxyFieldType getType(); 73 73 virtual void setUpgrade(int upgrade); 74 virtual bool canUpgrade();74 // virtual bool canUpgrade(); 75 75 virtual void createFree(int orientation); 76 76 virtual void createStart(int orientation); -
code/branches/TixyTaxyTorxy_HS18/src/modules/TixyTaxyTorxy/TixyTaxyTorxyTower.cc
r12064 r12086 10 10 11 11 #include "TixyTaxyTorxy.h" 12 13 12 #include "core/CoreIncludes.h" 14 13 //#include "core/XMLPort.h" … … 23 22 */ 24 23 TixyTaxyTorxyTower::TixyTaxyTorxyTower(Context* context) : Turret(context) 25 { 24 { 26 25 RegisterObject(TixyTaxyTorxyTower); 27 26 game_ =nullptr; 28 27 this->setCollisionType(WorldEntity::CollisionType::None); 29 28 upgrade = 1; 30 29 30 } 31 31 //this->removeAllEngines(); 32 32 … … 36 36 this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this))); 37 37 */ 38 }38 39 39 40 40 /*
Note: See TracChangeset
for help on using the changeset viewer.