- Timestamp:
- Jun 18, 2007, 9:27:34 AM (18 years ago)
- Location:
- branches/presentation/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/npcs/actionbox_enemy.cc
r10698 r10712 24 24 #include "playable.h" 25 25 26 #include "particles/dot_emitter.h" 27 #include "particles/emitter_node.h" 28 #include "particles/sprite_particles.h" 29 26 30 #include "actionbox_enemy.h" 27 31 … … 30 34 31 35 ActionboxEnemy::ActionboxEnemy(const TiXmlElement* root) 36 :weaponMan(this) 32 37 { 33 38 PRINTF(0)("ActionboxEnemy\n"); … … 49 54 if ( root ) 50 55 this->loadParams( root ); 56 57 58 this->weaponMan.setParentEntity( this); 59 //weapons: 60 61 this->weaponMan.setParentEntity( this); 62 63 this->weaponMan.setSlotCount(8); 64 65 this->weaponMan.createWeaponSlot(0, 3.270, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 66 this->weaponMan.createWeaponSlot(1, 3.270, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 67 this->weaponMan.createWeaponSlot(2, 4.385, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 68 this->weaponMan.createWeaponSlot(3, 4.385, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 69 this->weaponMan.createWeaponSlot(4, 1.635, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 70 this->weaponMan.createWeaponSlot(5, 1.536, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 71 this->weaponMan.createWeaponSlot(6, 1.536, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 72 this->weaponMan.createWeaponSlot(7, 1.536, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 73 74 75 this->weaponMan.addWeaponToSlot(0, 0, "RFCannon"); 76 this->weaponMan.addWeaponToSlot(0, 1, "RFCannon"); 77 this->weaponMan.addWeaponToSlot(0, 2, "RFCannon"); 78 this->weaponMan.addWeaponToSlot(0, 3, "RFCannon"); 79 this->weaponMan.addWeaponToSlot(1, 0, "RFCannon"); 80 this->weaponMan.addWeaponToSlot(1, 1, "RFCannon"); 81 this->weaponMan.addWeaponToSlot(1, 2, "RFCannon"); 82 this->weaponMan.addWeaponToSlot(1, 3, "RFCannon"); 83 84 this->weaponMan.addWeaponToSlot(0, 4, "NadionLaser"); 85 this->weaponMan.addWeaponToSlot(0, 5, "NadionLaser"); 86 this->weaponMan.addWeaponToSlot(2, 4, "NadionLaser"); 87 this->weaponMan.addWeaponToSlot(2, 5, "NadionLaser"); 88 89 this->weaponMan.addWeaponToSlot(0, 6, "Disruptor"); 90 this->weaponMan.addWeaponToSlot(0, 7, "Disruptor"); 91 this->weaponMan.addWeaponToSlot(3, 6, "Disruptor"); 92 this->weaponMan.addWeaponToSlot(3, 7, "Disruptor"); 93 94 this->weaponMan.changeWeaponConfig(0); 95 96 this->weaponMan.getFixedTarget()->setParent(this); 97 this->weaponMan.getFixedTarget()->setRelCoor(100000,0,0); 98 this->weaponMan.hideCrosshair(); 51 99 } 52 100 … … 62 110 void ActionboxEnemy::tick( float dt ) 63 111 { 112 weaponMan.tick( dt ); 64 113 this->bFire = false; 65 114 … … 123 172 { 124 173 this->bFire = true; 125 PRINTF(0)("FIRE\n");174 weaponMan.fire(); 126 175 } 127 176 } … … 263 312 WorldEntity::draw(); 264 313 } 314 315 void ActionboxEnemy::destroy( WorldEntity * killer ) 316 { 317 EmitterNode* node = NULL; 318 DotEmitter* emitter = NULL; 319 SpriteParticles* explosionParticles = NULL; 320 321 explosionParticles = new SpriteParticles(200); 322 explosionParticles->setName("SpaceShipExplosionParticles"); 323 explosionParticles->setLifeSpan(.2, .3); 324 explosionParticles->setRadius(0.0, 10.0); 325 explosionParticles->setRadius(.5, 6.0); 326 explosionParticles->setRadius(1.0, 3.0); 327 explosionParticles->setColor(0.0, 1,1,1,.9); 328 explosionParticles->setColor(0.1, 1,1,0,.9); 329 explosionParticles->setColor(0.5, .8,.4,0,.5); 330 explosionParticles->setColor(1.0, .2,.2,.2,.5); 331 332 333 emitter = new DotEmitter( 2000, 70, 360); 334 emitter->setEmissionRate( 200.0); 335 336 node = new EmitterNode( .1f); 337 node->setupParticle( emitter, explosionParticles); 338 node->setAbsDir( this->getAbsDir()); 339 node->setVelocity( this->getVelocity() * .9f); 340 node->setAbsCoor( this->getAbsCoor()); 341 if( !node->start()) 342 PRINTF(0)("Explosion node not correctly started!"); 343 344 this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0))); 345 } -
branches/presentation/src/world_entities/npcs/actionbox_enemy.h
r10698 r10712 19 19 20 20 virtual void loadParams(const TiXmlElement* root); 21 22 virtual void destroy( WorldEntity* killer ); 21 23 22 24 private: … … 41 43 void moveTowardsBox( ActionBox* box, float dt ); 42 44 void moveTowards( Vector targetPos, Vector targetDir, float dt ); 45 46 WeaponManager weaponMan; //!< the weapon manager: managing a list of energy weapons to wepaon-slot mapping 43 47 }; 44 48 -
branches/presentation/src/world_entities/weapons/bsp_weapon.cc
r10711 r10712 22 22 #include "environments/bsp_entity.h" 23 23 #include "loading/fast_factory.h" 24 #include "sound_engine.h" 24 25 25 26 ObjectListDefinition(BspWeapon); … … 41 42 BspWeapon::~BspWeapon () 42 43 { 43 // will be deleted 44 if ( soundSource_shoot.isPlaying() ) 45 soundSource_shoot.stop(); 44 46 } 45 47 … … 125 127 this->aimingSystem->setParent( this ); 126 128 this->aimingSystem->toList(list); 129 130 this->soundSource_shoot.setSourceNode(this); 131 this->soundBuffer_shoot = OrxSound::ResourceSoundBuffer("sounds/explosions/doulette.wav"); 127 132 128 133 } … … 130 135 void BspWeapon::shoot() 131 136 { 132 //gunFirExpl.explode(gunFire1,Vector(2,2,2)); 133 //gunFirExpl.explode(gunFire2,Vector(2,2,2));134 137 138 soundSource_shoot.play( soundBuffer_shoot, OrxSound::SoundEngine::getInstance()->getEffectsVolume(), 0.5); 139 135 140 for ( std::list<MuzzleFlash*>::iterator it = gunFire.begin(); it!=gunFire.end(); it++) 136 141 { -
branches/presentation/src/world_entities/weapons/bsp_weapon.h
r10704 r10712 73 73 bool alwaysHits; 74 74 void addPoint(float x, float y, float z); 75 76 OrxSound::SoundSource soundSource_shoot; 77 OrxSound::SoundBuffer soundBuffer_shoot;; 75 78 76 79 std::list<MuzzleFlash*> gunFire;
Note: See TracChangeset
for help on using the changeset viewer.