Changeset 9869 in orxonox.OLD for trunk/src/world_entities/weapons/targeting_turret.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/targeting_turret.cc
r9656 r9869 26 26 #include "util/loading/factory.h" 27 27 28 CREATE_FACTORY(TargetingTurret, CL_TARGETING_TURRET); 28 #include "class_id_DEPRECATED.h" 29 ObjectListDefinitionID(TargetingTurret, CL_TARGETING_TURRET); 30 CREATE_FACTORY(TargetingTurret); 29 31 30 32 31 33 TargetingTurret::TargetingTurret(const TiXmlElement* root) 32 : target(this)33 34 { 34 35 this->init(); … … 42 43 TargetingTurret::~TargetingTurret () 43 44 { 45 if(Aim::objectList().exists(target)) 46 delete target; 44 47 // model will be deleted from WorldEntity-destructor 45 48 // delete this->target; … … 48 51 void TargetingTurret::init() 49 52 { 50 this->setClassID(CL_TARGETING_TURRET, "TargetingTurret"); 53 this->registerObject(this, TargetingTurret::_objectList); 54 this->target = new Aim(this); 51 55 52 56 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this); … … 70 74 71 75 this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET); 72 this->setProjectileType (CL_GUIDED_MISSILE);76 this->setProjectileTypeC("GuidedMissile"); 73 77 74 78 … … 76 80 //this->getProjectileFactory()->prepare(100); 77 81 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;82 this->target->setVisibility(false); 83 this->target->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE); 84 this->target->setRange(1000); 85 this->target->setAngle(M_PI_4); 86 this->lockedTarget = this->target; 83 87 84 88 this->lockedTime = 0; … … 97 101 Weapon::loadParams(root); 98 102 99 LoadParam(root, "target-group", &target, Aim, setTargetGroupS);103 LoadParam(root, "target-group", target, Aim, setTargetGroupS); 100 104 101 105 } … … 109 113 void TargetingTurret::deactivate() 110 114 { 111 this->target .setVisibility(false);115 this->target->setVisibility(false); 112 116 } 113 117 … … 117 121 return; 118 122 119 this->target .tick(dt);123 this->target->tick(dt); 120 124 121 125 if( lockedTime >= neededLockTime ) 122 126 { 123 lockedTarget = this->target .getParent();127 lockedTarget = this->target->getParent(); 124 128 lockedTime = 0; 125 129 } 126 130 127 131 128 if(this->target .getParent() == PNode::getNullParent())132 if(this->target->getParent() == PNode::getNullParent()) 129 133 lockedTime = 0; 130 134 else
Note: See TracChangeset
for help on using the changeset viewer.