Changeset 9615 in orxonox.OLD
- Timestamp:
- Jul 30, 2006, 12:51:58 PM (18 years ago)
- Location:
- branches/proxy/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/world_entities/npcs/network_turret.cc
r9613 r9615 29 29 #include "effects/explosion.h" 30 30 31 #include "weapons/ targeting_turret.h"31 #include "weapons/aiming_turret.h" 32 32 33 33 CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET); … … 65 65 this->loadModel("models/ground_turret_#.obj", 5); 66 66 67 this->weapon = new TargetingTurret();67 this->weapon = new AimingTurret(); 68 68 this->weapon->loadModel("models/guns/turret2.obj", 10); 69 69 this->weapon->setParent(this); … … 117 117 diffVec = ( (*entity)->getAbsCoor() - this->getAbsCoor() ); 118 118 119 if ( diffVec.len() < 100 0 )//&& acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle)119 if ( diffVec.len() < 100.0 )//&& acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle) 120 120 { 121 121 //if (this->getParent() != (*entity)) -
branches/proxy/src/world_entities/npcs/network_turret.h
r9610 r9615 9 9 #include "npcs/npc.h" 10 10 11 class TargetingTurret;11 class AimingTurret; 12 12 13 13 //! A Class to ... … … 42 42 private: 43 43 PNode weaponHolder; 44 TargetingTurret *weapon;44 AimingTurret *weapon; 45 45 46 46 int targetGroup; -
branches/proxy/src/world_entities/projectiles/projectile.cc
r9406 r9615 45 45 this->explosionBuffer = NULL; 46 46 this->engineBuffer = NULL; 47 48 //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 47 49 } 48 50 -
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.