Changeset 10624 for code/trunk/src/modules/invader
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/modules/invader/CMakeLists.txt
r9958 r10624 13 13 14 14 ORXONOX_ADD_LIBRARY(invader 15 MODULE15 PLUGIN 16 16 FIND_HEADER_FILES 17 17 LINK_LIBRARIES -
code/trunk/src/modules/invader/Invader.cc
r9961 r10624 62 62 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 63 63 this->center_ = 0; 64 init();65 this->setHUDTemplate("InvaderHUD");66 }67 68 void Invader::init()69 {70 64 bEndGame = false; 71 65 lives = 3; … … 78 72 enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Invader::spawnEnemy, this))); 79 73 comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&Invader::comboControll, this))); 74 this->setHUDTemplate("InvaderHUD"); 80 75 } 81 76 … … 87 82 for (int i = 0; i < 7; i++) 88 83 { 89 WeakPtr<BigExplosion>chunk = new BigExplosion(this->center_->getContext());84 BigExplosion* chunk = new BigExplosion(this->center_->getContext()); 90 85 chunk->setPosition(Vector3(600, 0, 100.f * i - 300)); 91 86 chunk->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity() … … 99 94 } 100 95 101 WeakPtr<InvaderShip>Invader::getPlayer()96 InvaderShip* Invader::getPlayer() 102 97 { 103 98 if (player == NULL) … … 116 111 for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++) 117 112 { 118 WeakPtr<InvaderEnemy>newPawn;113 InvaderEnemy* newPawn; 119 114 if (rand() % 42/(1 + level*level) == 0) 120 115 { … … 155 150 void Invader::start() 156 151 { 157 init();158 152 // Set variable to temporarily force the player to spawn. 159 153 this->bForceSpawn_ = true; -
code/trunk/src/modules/invader/Invader.h
r9943 r10624 71 71 // checks if multiplier should be reset. 72 72 void comboControll(); 73 void init();74 73 int lives; 75 74 int multiplier; … … 78 77 private: 79 78 void toggleShowLevel(){bShowLevel = !bShowLevel;} 80 WeakPtr<InvaderShip>getPlayer();79 InvaderShip* getPlayer(); 81 80 WeakPtr<InvaderCenterPoint> center_; 82 81 WeakPtr<InvaderShip> player; -
code/trunk/src/modules/invader/InvaderCenterPoint.cc
r9943 r10624 54 54 } 55 55 56 void InvaderCenterPoint::changedGametype()57 {58 SUPER(InvaderCenterPoint, changedGametype);59 60 // Check, whether it's still Invader.61 this->checkGametype();62 }63 64 56 void InvaderCenterPoint::checkGametype() 65 57 { 66 58 if (this->getGametype() != NULL && this->getGametype()->isA(Class(Invader))) 67 59 { 68 Invader* InvaderGametype = orxonox_cast<Invader*>(this->getGametype() .get());60 Invader* InvaderGametype = orxonox_cast<Invader*>(this->getGametype()); 69 61 InvaderGametype->setCenterpoint(this); 70 62 } -
code/trunk/src/modules/invader/InvaderCenterPoint.h
r9943 r10624 49 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 50 50 51 virtual void changedGametype(); //!< Is called when the gametype has changed.52 51 private: 53 52 void checkGametype(); -
code/trunk/src/modules/invader/InvaderEnemy.cc
r9961 r10624 69 69 } 70 70 71 WeakPtr<Invader>InvaderEnemy::getGame()71 Invader* InvaderEnemy::getGame() 72 72 { 73 73 if (game == NULL) -
code/trunk/src/modules/invader/InvaderEnemy.h
r9943 r10624 49 49 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 50 50 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator); 51 virtual void setPlayer( WeakPtr<InvaderShip>player){this->player = player;}51 virtual void setPlayer(InvaderShip* player){this->player = player;} 52 52 53 53 int level; 54 54 protected: 55 WeakPtr<Invader>getGame();55 Invader* getGame(); 56 56 WeakPtr<Invader> game; 57 57 WeakPtr<InvaderShip> player; -
code/trunk/src/modules/invader/InvaderHUDinfo.cc
r9961 r10624 128 128 if (this->getOwner() && this->getOwner()->getGametype()) 129 129 { 130 this->InvaderGame = orxonox_cast<Invader*>(this->getOwner()->getGametype() .get());130 this->InvaderGame = orxonox_cast<Invader*>(this->getOwner()->getGametype()); 131 131 } 132 132 else -
code/trunk/src/modules/invader/InvaderShip.cc
r9943 r10624 91 91 92 92 // Camera 93 WeakPtr<Camera>camera = this->getCamera();93 Camera* camera = this->getCamera(); 94 94 if (camera != NULL) 95 95 { … … 142 142 { 143 143 // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint; 144 WeakPtr<InvaderEnemy>enemy = orxonox_cast<InvaderEnemy*>(otherObject);145 WeakPtr<Projectile>shot = orxonox_cast<Projectile*>(otherObject);144 InvaderEnemy* enemy = orxonox_cast<InvaderEnemy*>(otherObject); 145 Projectile* shot = orxonox_cast<Projectile*>(otherObject); 146 146 // ensure that this gets only called once per enemy. 147 147 if (enemy != NULL && lastEnemy != enemy) … … 171 171 } 172 172 173 WeakPtr<Invader>InvaderShip::getGame()173 Invader* InvaderShip::getGame() 174 174 { 175 175 if (game == NULL) -
code/trunk/src/modules/invader/InvaderShip.h
r9943 r10624 70 70 virtual void death(); 71 71 private: 72 WeakPtr<Invader>getGame();72 Invader* getGame(); 73 73 WeakPtr<Invader> game; 74 74 Camera* camera; -
code/trunk/src/modules/invader/InvaderWeapon.cc
r10216 r10624 68 68 // Create the projectile.projectile 69 69 projectile = new Projectile(this->getContext()); 70 WeakPtr<Model>model = new Model(projectile->getContext());70 Model* model = new Model(projectile->getContext()); 71 71 model->setMeshSource(mesh_); 72 72 model->setCastShadows(false);
Note: See TracChangeset
for help on using the changeset viewer.