Changeset 6863 for code/branches/rocket/src/modules/weapons
- Timestamp:
- May 7, 2010, 4:14:18 PM (15 years ago)
- Location:
- code/branches/rocket/src/modules/weapons
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/rocket/src/modules/weapons/RocketController.cc
r6834 r6863 48 48 this->rocket->setController(dynamic_cast<RocketController*>(this)); 49 49 this->setControllableEntity(dynamic_cast<ControllableEntity*> (rocket)); 50 this->haha=0; 50 51 } 51 52 … … 59 60 void RocketController::tick(float dt) 60 61 { 62 haha++; 61 63 62 64 SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity()); 63 double rd = rand(); 64 if (rd > 0.5) rocket->rotateRoll(5); 65 rocket->setAcceleration(rocket->getAcceleration()*2); 66 if (haha < 100) rocket->rotateYaw(10); 67 else { 68 if (rand() > 0.5) rocket->rotateRoll(5); 65 69 else rocket->rotatePitch(5); 70 } 66 71 67 72 } … … 69 74 70 75 RocketController::~RocketController() { 76 71 77 COUT(0)<< "RocketController destroyed\n"; 72 78 } -
code/branches/rocket/src/modules/weapons/RocketController.h
r6834 r6863 52 52 53 53 virtual void tick(float dt); 54 SimpleRocket* getRocket(){return rocket;};54 SimpleRocket* getRocket(){return this->rocket;}; 55 55 protected: 56 56 … … 58 58 private: 59 59 SimpleRocket* rocket; 60 WeakPtr<PlayerInfo> player_; 61 int haha; 62 60 63 61 64 }; -
code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc
r6834 r6863 98 98 { 99 99 if (this->isInitialized()) { 100 this->getController()->destroy(); 100 101 COUT(0)<< "simplerocket destroyed\n"; 101 delete this->getController();102 102 } 103 103 } … … 158 158 if (victim) 159 159 victim->hit(this->owner_, contactPoint, dmg); 160 //this->destroy();160 this->destroy(); 161 161 } 162 162 return false; -
code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.h
r6834 r6863 112 112 { return this->damage_; } 113 113 virtual void fired(unsigned int firemode); 114 114 115 115 116 private: … … 118 119 float damage_; 119 120 bool bDestroy_; 121 120 122 121 123 WeakPtr<PlayerInfo> player_; -
code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r6834 r6863 45 45 { 46 46 RegisterObject(SimpleRocketFire); 47 48 47 49 /*this->reloadTime_ = 0.20f;48 this->reloadTime_ = 0.20f; 50 49 this->bParallelReload_ = false; 51 50 this->damage_ = 100; 52 this->speed_ = 50 0;51 this->speed_ = 50; 53 52 54 this->setMunitionName("LaserMunition"); */53 this->setMunitionName("LaserMunition"); 55 54 // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning) 56 55 } … … 67 66 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 68 67 rocket->setOrientation(this->getMuzzleOrientation()); 69 rocket->setPosition(this->getMuzzlePosition()); 70 rocket->setVelocity(this->getMuzzleDirection() * rocket->getVelocity()); 68 Vector3 pos = this->getMuzzlePosition() + (this->getMuzzleOrientation()* Vector3(-2, -3, -2)); 69 rocket->setPosition(pos); 70 rocket->setVelocity(this->getMuzzleDirection()*this->speed_); 71 //Ogre::Vector3 vec = this->getMuzzlePosition(); 72 //vec.normalise(); 73 //rocket->setAcceleration(100*vec); 71 74 rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 72 75 //con->getRocket()->setPosition(this->getMuzzlePosition()); 73 //con->setControllableEntity(dynamic_cast< ControllableEntity*>(rocket));76 //con->setControllableEntity(dynamic_cast<rocket*>(ControllableEntity)); 74 77 //con->getControllableEntity()->setPosition(this->getMuzzlePosition()); 75 78
Note: See TracChangeset
for help on using the changeset viewer.