Changeset 10600 in orxonox.OLD for branches/cleanup/src/world_entities/weapons/acid_launcher.cc
- Timestamp:
- Mar 5, 2007, 11:37:52 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cleanup/src/world_entities/weapons/acid_launcher.cc
r10579 r10600 37 37 using namespace std; 38 38 39 ObjectListDefinition (AcidLauncher);40 CREATE_FACTORY (AcidLauncher);39 ObjectListDefinition ( AcidLauncher ); 40 CREATE_FACTORY ( AcidLauncher ); 41 41 42 42 /** … … 46 46 */ 47 47 AcidLauncher::AcidLauncher() 48 : Weapon()48 : Weapon() 49 49 { 50 50 this->init(); … … 54 54 * creates a new AcidLauncher from a TiXmlElement 55 55 */ 56 AcidLauncher::AcidLauncher (const TiXmlElement* root)56 AcidLauncher::AcidLauncher ( const TiXmlElement* root ) 57 57 { 58 58 this->init(); 59 if ( root != NULL)60 this->loadParams (root);59 if ( root != NULL ) 60 this->loadParams ( root ); 61 61 } 62 62 … … 71 71 void AcidLauncher::init() 72 72 { 73 this->registerObject (this, AcidLauncher::_objectList);74 /*75 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);76 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); 77 77 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);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); 82 82 83 animation1->setInfinity(ANIM_INF_CONSTANT);84 animation2->setInfinity(ANIM_INF_CONSTANT);85 */86 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 ); 87 87 88 this->setStateDuration (WS_RELOADING, 1.0f);89 this->setStateDuration (WS_ACTIVATING, .4);90 this->setStateDuration (WS_DEACTIVATING, .4);88 this->setStateDuration ( WS_RELOADING, 1.0f ); 89 this->setStateDuration ( WS_ACTIVATING, .4 ); 90 this->setStateDuration ( WS_DEACTIVATING, .4 ); 91 91 92 this->setEnergyMax (100);93 this->increaseEnergy (100);92 this->setEnergyMax ( 100 ); 93 this->increaseEnergy ( 100 ); 94 94 //this->minCharge = 2; 95 95 96 this->setCapability (WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT);97 this->setProjectileTypeC ("AcidSplash");96 this->setCapability ( WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT ); 97 this->setProjectileTypeC ( "AcidSplash" ); 98 98 // this->loadModel("models/guns/turret1.obj", 1.0); 99 99 100 this->setEmissionPoint (2.0, 0, 0);101 this->getProjectileFactory()->prepare (10);100 this->setEmissionPoint ( 2.0, 0, 0 ); 101 this->getProjectileFactory()->prepare ( 10 ); 102 102 103 this->setActionSound (WA_SHOOT, "sounds/explosions/explosion_1.wav");104 this->setActionSound (WA_ACTIVATE, "sounds/voices/rockets.wav");103 this->setActionSound ( WA_SHOOT, "sounds/explosions/explosion_1.wav" ); 104 this->setActionSound ( WA_ACTIVATE, "sounds/voices/rockets.wav" ); 105 105 // this->setActionSound(WA_RELOAD, "sounds/voices/reload.wav"); 106 106 107 107 } 108 108 109 void AcidLauncher::loadParams (const TiXmlElement* root)109 void AcidLauncher::loadParams ( const TiXmlElement* root ) 110 110 { 111 Weapon::loadParams (root);111 Weapon::loadParams ( root ); 112 112 } 113 113 114 114 void AcidLauncher::activate() 115 { 116 } 115 {} 117 116 118 117 void AcidLauncher::deactivate() 118 {} 119 120 void AcidLauncher::tick ( float dt ) 119 121 { 120 } 121 122 void AcidLauncher::tick(float dt) 123 { 124 if (!Weapon::tickW(dt)) 122 if ( !Weapon::tickW ( dt ) ) 125 123 return; 126 if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized) 127 { 128 this->energyWidget->setDisplayedImage("textures/gui/gui_acid.png"); 124 if ( this->energyWidget != NULL && !this->isEnergyWidgetInitialized ) { 125 this->energyWidget->setDisplayedImage ( "textures/gui/gui_acid.png" ); 129 126 this->isEnergyWidgetInitialized = true; 130 127 } … … 155 152 156 153 Projectile* pj = NULL; 157 for( int i=0; i < 1; i++) 158 { 159 pj = this->getProjectile(); 160 if (pj == NULL) 161 return; 154 for ( int i=0; i < 1; i++ ) { 155 pj = this->getProjectile(); 156 if ( pj == NULL ) 157 return; 162 158 163 164 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 ) ) ); 165 161 166 pj->setParent(PNode::getNullParent());167 pj->setAbsCoor(this->getEmissionPoint() + VECTOR_RAND(.1));168 pj->setAbsDir(this->getAbsDir()+Quaternion(0,VECTOR_RAND(5)));169 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(); 170 166 } 171 167 }
Note: See TracChangeset
for help on using the changeset viewer.