Changeset 9656 in orxonox.OLD for trunk/src/world_entities/weapons/targeting_turret.cc
- Timestamp:
- Aug 4, 2006, 11:01:28 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/targeting_turret.cc
r9406 r9656 17 17 #include "targeting_turret.h" 18 18 19 #include "weapon_manager.h" 20 #include "aim.h" 21 #include "world_entities/projectiles/projectile.h" 19 #include "projectiles/projectile.h" 22 20 23 21 #include "model.h" … … 25 23 #include "animation3d.h" 26 24 25 #include "util/loading/load_param.h" 27 26 #include "util/loading/factory.h" 28 27 … … 30 29 31 30 32 33 34 /**35 * standard constructor36 37 creates a new weapon38 */39 TargetingTurret::TargetingTurret ()40 : Weapon()41 {42 this->init();43 44 }45 46 47 31 TargetingTurret::TargetingTurret(const TiXmlElement* root) 32 : target(this) 48 33 { 49 34 this->init(); … … 91 76 //this->getProjectileFactory()->prepare(100); 92 77 93 this->target = new Aim(this);94 this->target ->setVisibility(false);95 this->target ->setRange(1000);96 this->target ->setAngle(M_PI_4);97 this->lockedTarget = this->target;78 this->target.setVisibility(false); 79 this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE); 80 this->target.setRange(1000); 81 this->target.setAngle(M_PI_4); 82 this->lockedTarget = &this->target; 98 83 99 84 this->lockedTime = 0; … … 112 97 Weapon::loadParams(root); 113 98 99 LoadParam(root, "target-group", &target, Aim, setTargetGroupS); 100 114 101 } 115 102 … … 122 109 void TargetingTurret::deactivate() 123 110 { 124 this->target ->setVisibility(false);111 this->target.setVisibility(false); 125 112 } 126 113 … … 130 117 return; 131 118 119 this->target.tick(dt); 120 132 121 if( lockedTime >= neededLockTime ) 133 122 { 134 lockedTarget = this->target ->getParent();123 lockedTarget = this->target.getParent(); 135 124 lockedTime = 0; 136 125 } 137 126 138 this->target->tick(dt);139 127 140 if(this->target ->getParent() == PNode::getNullParent())128 if(this->target.getParent() == PNode::getNullParent()) 141 129 lockedTime = 0; 142 130 else … … 159 147 pj->setAbsDir(this->getAbsDir()); 160 148 pj->activate(); 161 162 149 } 163 150
Note: See TracChangeset
for help on using the changeset viewer.