Changeset 9615 in orxonox.OLD for branches/proxy/src/world_entities/weapons
- Timestamp:
- Jul 30, 2006, 12:51:58 PM (18 years ago)
- Location:
- branches/proxy/src/world_entities/weapons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/world_entities/weapons/aiming_turret.cc
r9406 r9615 38 38 */ 39 39 AimingTurret::AimingTurret () 40 : Weapon() 40 : Weapon(), target(this) 41 41 { 42 42 this->init(); … … 46 46 47 47 AimingTurret::AimingTurret(const TiXmlElement* root) 48 : target(this) 48 49 { 49 50 this->init(); … … 91 92 //this->getProjectileFactory()->prepare(100); 92 93 93 this->target = new Aim(this);94 this->target ->setVisibility(false);95 this->target ->setRange(400);96 this->target ->setAngle(M_PI_2);94 this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE); 95 this->target.setVisibility(false); 96 this->target.setRange(400); 97 this->target.setAngle(M_PI_2); 97 98 98 99 this->setActionSound(WA_SHOOT, "sound/explosions/explosion_3.wav"); … … 110 111 void AimingTurret::activate() 111 112 { 112 this->target ->setVisibility(true);113 this->target.setVisibility(true); 113 114 } 114 115 115 116 void AimingTurret::deactivate() 116 117 { 117 this->target ->setVisibility(false);118 this->target.setVisibility(false); 118 119 } 119 120 … … 123 124 return; 124 125 Quaternion quat; 125 Vector direction = this->target ->getAbsCoor() - this->getAbsCoor();126 Vector direction = this->target.getAbsCoor() - this->getAbsCoor(); 126 127 127 128 direction.normalize(); … … 134 135 this->setAbsDirSoft(quat, 5); 135 136 136 this->target ->tick(dt);137 this->target.tick(dt); 137 138 } 138 139 … … 144 145 145 146 pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13) 146 /*target ->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());147 /*target.getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 147 148 148 149 pj->setParent(PNode::getNullParent()); -
branches/proxy/src/world_entities/weapons/aiming_turret.h
r8777 r9615 8 8 9 9 #include "weapon.h" 10 10 #include "aim.h" 11 11 /* FORWARD DECLARATION */ 12 class Aim;13 12 14 13 class AimingTurret : public Weapon 15 16 17 18 19 14 { 15 public: 16 AimingTurret (); 17 AimingTurret(const TiXmlElement* root); 18 virtual ~AimingTurret (); 20 19 21 void init(); 22 virtual void loadParams(const TiXmlElement* root); 20 virtual void loadParams(const TiXmlElement* root); 23 21 24 virtual void activate(); 25 virtual void deactivate(); 22 void setTargetGroup(OM_LIST targetGroup) { this->target.setTargetGroup(targetGroup); }; 26 23 27 virtual void tick(float dt); 28 virtual void fire(); 24 virtual void activate(); 25 virtual void deactivate(); 26 27 virtual void tick(float dt); 28 virtual void fire(); 29 29 30 30 31 31 virtual void draw() const; 32 32 33 private: 34 Aim* target; 35 }; 33 private: 34 void init(); 35 36 private: 37 Aim target; 38 }; 36 39 37 40 #endif /* _AIMING_TURRET_H */
Note: See TracChangeset
for help on using the changeset viewer.