- Timestamp:
- Jul 28, 2005, 3:52:29 PM (19 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/player.cc
r4963 r4964 89 89 this->weaponMan->addWeapon(wpLeft, 1, 0); 90 90 this->weaponMan->addWeapon(wpRight,1 ,1); 91 this->weaponMan->addWeapon(turret, 3, 1);91 this->weaponMan->addWeapon(turret, 3, 2); 92 92 93 93 this->weaponMan->changeWeaponConfig(0); … … 110 110 111 111 this->weaponMan = new WeaponManager(this); 112 this->weaponMan->setSlotCount(3); 112 113 this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0)); 113 114 this->weaponMan->setSlotPosition(1, Vector(-2.6, .1, 3.0)); 114 115 this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, 0)); 115 116 } 116 117 -
orxonox/trunk/src/world_entities/weapons/turret.cc
r4963 r4964 43 43 44 44 this->model = (Model*)ResourceManager::getInstance()->load("models/turret1.obj", OBJ, RP_CAMPAIGN); 45 this->leftRight = leftRight;46 45 47 /* this->objectComponent1 = new PNode(); 48 Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1); 49 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); 50 Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this); 51 //parent->addChild(this->objectComponent1, PNODE_ALL); 52 this->addChild(this->objectComponent1, PNODE_ALL); 46 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this); 47 Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this); 48 49 animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 50 animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 51 animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 52 animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 53 53 54 54 animation1->setInfinity(ANIM_INF_CONSTANT); 55 55 animation2->setInfinity(ANIM_INF_CONSTANT); 56 animation3->setInfinity(ANIM_INF_CONSTANT);57 if( this->leftRight == W_LEFT)58 {59 this->setEmissionPoint(1.0, 0.0, -0.35);60 61 animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);62 animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);63 animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);64 65 animation2->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);66 animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);67 68 animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);69 animation3->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);70 }71 else if( this->leftRight == W_RIGHT)72 {73 this->setEmissionPoint(1.0, 0.0, 0.5);74 75 this->objectComponent1->setRelCoor(Vector(0,0,0.35));76 animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);77 animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);78 animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);79 80 animation2->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);81 animation2->addKeyFrame(Vector(.0, .0, .0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);82 83 animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);84 animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);85 }*/86 87 // ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);88 //ObjectManager::getInstance()->debug();89 56 90 57 this->setStateDuration(WS_SHOOTING, .4); 91 this->setStateDuration(WS_RELOADING, 1);58 this->setStateDuration(WS_RELOADING, 2); 92 59 this->setStateDuration(WS_ACTIVATING, .4); 93 60 this->setStateDuration(WS_DEACTIVATING, .4); … … 100 67 101 68 this->setProjectile(CL_TEST_BULLET); 69 70 this->setEmissionPoint(1.684, 0.472, 0); 102 71 //this->getProjectileFactory()->prepare(100); 103 72 } … … 112 81 } 113 82 114 115 /**116 * this activates the weapon117 118 This is needed, since there can be more than one weapon on a ship. the119 activation can be connected with an animation. for example the weapon is120 been armed out.121 */122 83 void Turret::activate() 123 84 { 124 85 } 125 86 126 127 /**128 * this deactivates the weapon129 130 This is needed, since there can be more than one weapon on a ship. the131 activation can be connected with an animation. for example the weapon is132 been armed out.133 */134 87 void Turret::deactivate() 135 88 { 136 89 } 137 90 91 void Turret::tick(float dt) 92 { 93 Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor(); 94 direction.normalize(); 95 Quaternion quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ; 96 97 this->setRelDir(quat); 98 } 138 99 139 100 /** … … 141 102 142 103 this is called from the player.cc, when fire-button is been pushed 143 @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent144 104 */ 145 105 void Turret::fire() … … 152 112 { 153 113 pj->setVelocity(this->getVelocity()+(target->getAbsCoor() - this->getAbsCoor())*.5);//this->getVelocity()); 114 pj->setAbsDir(this->getAbsDir()); 154 115 } 155 116 else -
orxonox/trunk/src/world_entities/weapons/turret.h
r4963 r4964 18 18 virtual void deactivate(); 19 19 20 virtual void tick(float dt); 20 21 virtual void fire(); 21 22 virtual void destroy(); … … 24 25 25 26 private: 26 PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation27 28 int leftRight; // this will become an enum29 27 }; 30 28 #endif /* _TURRET_H */ -
orxonox/trunk/src/world_entities/weapons/weapon_manager.h
r4959 r4964 54 54 void loadWeapons(const TiXmlElement* root); 55 55 56 void setSlotCount(unsigned int slotCount); 56 57 // setting up the WeaponManager with the following functions 57 58 void setSlotPosition(int slot, const Vector& position); … … 85 86 86 87 private: 87 void setSlotCount(unsigned int slotCount);88 89 88 int getNextFreeSlot(int configID); 90 89
Note: See TracChangeset
for help on using the changeset viewer.