Changeset 10618 in orxonox.OLD for trunk/src/world_entities/weapons/acid_launcher.cc
- Timestamp:
- Apr 4, 2007, 12:13:53 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 16 16 OrxonoxPlayability.kdevses 17 17 OrxonoxPlayability.kdevelop.pcs 18 orxonox.backtrace 19 orxonox.kdevses 20 orxonox.kdevelop.pcs
-
- Property svn:ignore
-
trunk/src/world_entities/weapons/acid_launcher.cc
r10539 r10618 29 29 #include "util/state.h" 30 30 31 #include "math/quaternion.h"32 33 31 #include "util/loading/factory.h" 34 32 … … 39 37 using namespace std; 40 38 41 ObjectListDefinition (AcidLauncher);42 CREATE_FACTORY (AcidLauncher);39 ObjectListDefinition ( AcidLauncher ); 40 CREATE_FACTORY ( AcidLauncher ); 43 41 44 42 /** … … 48 46 */ 49 47 AcidLauncher::AcidLauncher() 50 : Weapon()48 : Weapon() 51 49 { 52 50 this->init(); … … 56 54 * creates a new AcidLauncher from a TiXmlElement 57 55 */ 58 AcidLauncher::AcidLauncher (const TiXmlElement* root)56 AcidLauncher::AcidLauncher ( const TiXmlElement* root ) 59 57 { 60 58 this->init(); 61 if ( root != NULL)62 this->loadParams (root);59 if ( root != NULL ) 60 this->loadParams ( root ); 63 61 } 64 62 … … 73 71 void AcidLauncher::init() 74 72 { 75 this->registerObject (this, AcidLauncher::_objectList);76 /*77 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);78 Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this);73 this->registerObject ( this, AcidLauncher::_objectList ); 74 /* 75 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this); 76 Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this); 79 77 80 animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);81 animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);82 animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);83 animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);78 animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 79 animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 80 animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 81 animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 84 82 85 animation1->setInfinity(ANIM_INF_CONSTANT);86 animation2->setInfinity(ANIM_INF_CONSTANT);87 */88 this->setStateDuration (WS_SHOOTING, 1.0f);83 animation1->setInfinity(ANIM_INF_CONSTANT); 84 animation2->setInfinity(ANIM_INF_CONSTANT); 85 */ 86 this->setStateDuration ( WS_SHOOTING, 1.0f ); 89 87 90 this->setStateDuration (WS_RELOADING, 1.0f);91 this->setStateDuration (WS_ACTIVATING, .4);92 this->setStateDuration (WS_DEACTIVATING, .4);88 this->setStateDuration ( WS_RELOADING, 1.0f ); 89 this->setStateDuration ( WS_ACTIVATING, .4 ); 90 this->setStateDuration ( WS_DEACTIVATING, .4 ); 93 91 94 this->setEnergyMax (100);95 this->increaseEnergy (100);92 this->setEnergyMax ( 100 ); 93 this->increaseEnergy ( 100 ); 96 94 //this->minCharge = 2; 97 95 98 this->setCapability (WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT);99 this->setProjectileTypeC ("AcidSplash");96 this->setCapability ( WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT ); 97 this->setProjectileTypeC ( "AcidSplash" ); 100 98 // this->loadModel("models/guns/turret1.obj", 1.0); 101 99 102 this->setEmissionPoint (2.0, 0, 0);103 this->getProjectileFactory()->prepare (10);100 this->setEmissionPoint ( 2.0, 0, 0 ); 101 this->getProjectileFactory()->prepare ( 10 ); 104 102 105 this->setActionSound (WA_SHOOT, "sounds/explosions/explosion_1.wav");106 this->setActionSound (WA_ACTIVATE, "sounds/voices/rockets.wav");107 this->setActionSound(WA_RELOAD, "sounds/voices/reload.wav");103 this->setActionSound ( WA_SHOOT, "sounds/explosions/explosion_1.wav" ); 104 this->setActionSound ( WA_ACTIVATE, "sounds/voices/rockets.wav" ); 105 // this->setActionSound(WA_RELOAD, "sounds/voices/reload.wav"); 108 106 109 107 } 110 108 111 void AcidLauncher::loadParams (const TiXmlElement* root)109 void AcidLauncher::loadParams ( const TiXmlElement* root ) 112 110 { 113 Weapon::loadParams (root);111 Weapon::loadParams ( root ); 114 112 } 115 113 116 114 void AcidLauncher::activate() 117 { 118 } 115 {} 119 116 120 117 void AcidLauncher::deactivate() 118 {} 119 120 void AcidLauncher::tick ( float dt ) 121 121 { 122 } 123 124 void AcidLauncher::tick(float dt) 125 { 126 if (!Weapon::tickW(dt)) 122 if ( !Weapon::tickW ( dt ) ) 127 123 return; 128 if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized) 129 { 130 this->energyWidget->setDisplayedImage("textures/gui/gui_acid.png"); 124 if ( this->energyWidget != NULL && !this->isEnergyWidgetInitialized ) { 125 this->energyWidget->setDisplayedImage ( "textures/gui/gui_acid.png" ); 131 126 this->isEnergyWidgetInitialized = true; 132 127 } … … 157 152 158 153 Projectile* pj = NULL; 159 for( int i=0; i < 1; i++) 160 { 161 pj = this->getProjectile(); 162 if (pj == NULL) 163 return; 154 for ( int i=0; i < 1; i++ ) { 155 pj = this->getProjectile(); 156 if ( pj == NULL ) 157 return; 164 158 165 166 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 + VECTOR_RAND(10)));159 fired = true; 160 pj->setVelocity ( this->getVelocity() + ( this->getAbsDir().apply ( Vector ( 1,0,0 ) ) *165.0 + VECTOR_RAND ( 10 ) ) ); 167 161 168 pj->setParent(PNode::getNullParent());169 pj->setAbsCoor(this->getEmissionPoint() + VECTOR_RAND(.1));170 pj->setAbsDir(this->getAbsDir()+Quaternion(0,VECTOR_RAND(5)));171 162 pj->setParent ( PNode::getNullParent() ); 163 pj->setAbsCoor ( this->getEmissionPoint() + VECTOR_RAND ( .1 ) ); 164 pj->setAbsDir ( this->getAbsDir() +Quaternion ( 0,VECTOR_RAND ( 5 ) ) ); 165 pj->activate(); 172 166 } 173 167 }
Note: See TracChangeset
for help on using the changeset viewer.