Changeset 9957 in orxonox.OLD for branches/playability
- Timestamp:
- Nov 24, 2006, 11:58:23 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/projectile.cc
r9953 r9957 122 122 123 123 124 125 void Projectile::collidesWith (WorldEntity* entity, const Vector& location) 126 { 127 //if (entity->isA(CL_SPACE_SHIP)) /* FIXME make sure that entity is a spaceship*/ 128 // entity->damage(this->physDamage, this->elecDamage); /* and do some damage*/ 129 this->destroy(entity); 130 } 131 124 132 /** 125 133 * signal tick, time dependent things will be handled here … … 145 153 } 146 154 147 148 149 155 int Projectile::getPhysDamage () { return this->physDamage; } 150 156 -
branches/playability/src/world_entities/projectiles/projectile.h
r9953 r9957 44 44 virtual void destroy (WorldEntity* killer); 45 45 46 virtual void collidesWith (WorldEntity* entity, const Vector& location); //!< collision handler as used in diverse weapons 47 46 48 virtual void tick (float dt); 47 49 /** @brief convenience function -
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 } -
branches/playability/src/world_entities/space_ships/space_ship.h
r9953 r9957 48 48 49 49 //Functions for GUI 50 virtual int getShieldCur();//!< returns current shield value51 virtual int getShieldMax();//!< returns maximum shield value50 inline float getShieldCur() { return this->shieldCur; }; //!< returns current shield value 51 inline float getShieldMax() { return this->shieldMax; }; //!< returns maximum shield value 52 52 53 virtual int getArmorCur();//!< returns current armor value54 virtual int getArmorMax();//!< returns current armor value53 inline float getArmorCur() { return this->armorCur; }; //!< returns current armor value 54 inline float getArmorMax() { return this->armorMax; }; //!< returns current armor value 55 55 56 virtual int getElectronicCur(); //!< returns current electronic value57 virtual int getElectronicMax(); //!< returns current electronic value56 inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value 57 inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value 58 58 59 59 //damage handler 60 virtual void damage( int pDamage, int eDamage); //!< pDamage physical damage, eDamage electronic damage60 virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage 61 61 62 62 private: … … 65 65 void calculateVelocity(float time); 66 66 67 void regen( ); //!< handler for shield and electronic regeneration67 void regen(float time); //!< handler for shield and electronic regeneration 68 68 69 69 //ship atributes 70 intshieldCur; //!< current shield71 intshieldMax; //!< maximum shield70 float shieldCur; //!< current shield 71 float shieldMax; //!< maximum shield 72 72 float shieldEnergyShare; //!< percentage of reactor output 73 int shieldRegen; //!< shield regeneration rate74 intshieldTH; //!< shield threshhold for reactivation73 float shieldRegen; //!< shield regeneration rate per tick 74 float shieldTH; //!< shield threshhold for reactivation 75 75 bool shieldActive; //!< wheather the shield is working 76 76 77 intarmorCur; //!< current armor78 intarmorMax; //!< maximum armor77 float armorCur; //!< current armor 78 float armorMax; //!< maximum armor 79 79 80 intelectronicCur; //!< current electronic81 intelectronicMax; //!< maximum electronic82 int electronicRegen; //!< electronic regenration rate80 float electronicCur; //!< current electronic 81 float electronicMax; //!< maximum electronic 82 float electronicRegen; //!< electronic regenration rate per tick 83 83 84 84 int engineSpeedCur; //!< speed output
Note: See TracChangeset
for help on using the changeset viewer.