Changeset 9957 in orxonox.OLD for branches/playability/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Nov 24, 2006, 11:58:23 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/space_ships/space_ship.cc
r9953 r9957 521 521 522 522 523 int SpaceShip::getShieldCur () { return this->shieldCur; } 524 int SpaceShip::getShieldMax () { return this->shieldMax; } 525 526 int SpaceShip::getArmorCur () { return this->armorCur; } 527 int SpaceShip::getArmorMax () { return this->armorMax; } 528 529 int SpaceShip::getElectronicCur () { return this->electronicCur; } 530 int SpaceShip::getElectronicMax () { return this->electronicMax; } 531 532 void SpaceShip::damage(int pDamage, int eDamage){ 523 void SpaceShip::damage(float pDamage, float eDamage){ 533 524 if( this->shieldActive) { 534 525 if( this->shieldCur > pDamage) { … … 540 531 pDamage = pDamage - this->shieldCur; 541 532 if( !this->shieldActive) { 542 this->armorCur = pDamage / 2; // remaining damages hits armor at half rate533 this->armorCur -= pDamage / 2; // remaining damages hits armor at half rate 543 534 this->electronicCur -= eDamage; 544 535 } … … 552 543 } 553 544 554 void SpaceShip::regen( ){555 int time = 1; // FIXME implement tick time calculation556 if (this->shieldCur == this->shieldMax){}557 else {558 if( t his->shieldCur + this->shieldRegen * time> shieldMax)545 void SpaceShip::regen(float time){ 546 float tmp; 547 if (this->shieldCur != this->shieldMax){ 548 tmp = this->shieldCur + this->shieldRegen * time; 549 if( tmp > shieldMax) 559 550 this->shieldCur = this->shieldMax; 560 551 else 561 this->shieldCur += this->shieldRegen * time; 562 if( this->shieldCur > shieldTH) 563 this->shieldActive = true; 564 } 565 if (this->electronicCur == this->electronicMax){} 566 else{ 567 if (this->electronicCur + this->electronicRegen * time > electronicMax) 552 this->shieldCur = tmp; 553 this->shieldActive = ( this->shieldActive || this->shieldCur > shieldTH); 554 } 555 if (this->electronicCur != this->electronicMax){ 556 tmp = this->electronicCur + this->electronicRegen * time; 557 if ( tmp > electronicMax) 568 558 this->electronicCur = this->electronicMax; 569 559 else 570 this->electronicCur += this->electronicRegen * time; 571 } 572 } 573 560 this->electronicCur = tmp; 561 } 562 }
Note: See TracChangeset
for help on using the changeset viewer.