Changeset 6900 for code/branches/rocket
- Timestamp:
- May 14, 2010, 12:41:04 PM (15 years ago)
- Location:
- code/branches/rocket/src/modules/weapons
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/rocket/src/modules/weapons/RocketController.cc
r6863 r6900 42 42 RocketController::RocketController(BaseObject* creator) : Controller(creator) 43 43 { 44 RegisterObject(RocketController); 44 45 COUT(0)<< "RocketController constructed\n"; 45 46 46 RegisterObject(RocketController);47 47 48 this->rocket = new SimpleRocket(this); 48 this->rocket->setController( dynamic_cast<RocketController*>(this));49 this->rocket->setController(this); 49 50 this->setControllableEntity(dynamic_cast<ControllableEntity*> (rocket)); 50 51 this->haha=0; … … 63 64 64 65 SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity()); 65 rocket->setAcceleration(rocket->getAcceleration()*2); 66 if (haha < 100) rocket->rotateYaw(10); 67 else { 68 if (rand() > 0.5) rocket->rotateRoll(5); 69 else rocket->rotatePitch(5); 70 } 71 72 } 66 rocket->moveRightLeft(5); 67 68 } 73 69 74 70 75 71 RocketController::~RocketController() { 72 76 73 77 74 COUT(0)<< "RocketController destroyed\n"; -
code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.cc
r6878 r6900 62 62 63 63 64 //if (GameMode::isMaster())65 //{64 if (GameMode::isMaster()) 65 { 66 66 this->setCollisionType(WorldEntity::Kinematic); 67 67 this->setVelocity(0,0,100); … … 87 87 88 88 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this))); 89 // } 90 91 } 89 } 90 91 } 92 void SimpleRocket::tick(float dt) 93 { 94 SUPER(SimpleRocket, tick, dt); 95 } 92 96 93 97 /**s -
code/branches/rocket/src/modules/weapons/projectiles/SimpleRocket.h
r6863 r6900 51 51 SimpleRocket(BaseObject* creator); 52 52 virtual ~SimpleRocket(); 53 53 virtual void tick(float dt); 54 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML. 55 55 -
code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r6863 r6900 61 61 void SimpleRocketFire::fire() 62 62 { 63 //SimpleRocket* rocket = new SimpleRocket(this);64 63 RocketController* con = new RocketController(this); 65 64 SimpleRocket* rocket = con->getRocket(); … … 69 68 rocket->setPosition(pos); 70 69 rocket->setVelocity(this->getMuzzleDirection()*this->speed_); 71 //Ogre::Vector3 vec = this->getMuzzlePosition();72 //vec.normalise();73 //rocket->setAcceleration(100*vec);74 70 rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 75 //con->getRocket()->setPosition(this->getMuzzlePosition());76 //con->setControllableEntity(dynamic_cast<rocket*>(ControllableEntity));77 //con->getControllableEntity()->setPosition(this->getMuzzlePosition());78 79 /* this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());80 rocket->setOrientation(this->getMuzzleOrientation());81 rocket->setPosition(this->getMuzzlePosition());82 rocket->scale(10);83 rocket->setVelocity(this->getMuzzleDirection() * this->speed_);84 rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());85 rocket->setDamage(this->getDamage());86 rocket->scale(2);87 */88 71 } 89 72 }
Note: See TracChangeset
for help on using the changeset viewer.