Changeset 9829 for code/branches/invaders/src/modules
- Timestamp:
- Nov 25, 2013, 6:51:39 PM (11 years ago)
- Location:
- code/branches/invaders/src/modules/invader
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/invaders/src/modules/invader/Invader.cc
r9828 r9829 64 64 this->setHUDTemplate("InvaderHUD"); 65 65 66 lives = 3; 67 level = 1; 68 point = 0; 69 multiplier = 1; 70 b_combo = false; 66 71 enemySpawnTimer.setTimer(2.0f, true, createExecutor(createFunctor(&Invader::spawnEnemy, this))); 72 comboTimer.setTimer(2.5f, true, createExecutor(createFunctor(&Invader::comboControll, this))); 67 73 } 68 74 … … 85 91 86 92 newPawn->setPosition(player->getPosition() + Vector3(1000, 0, 0)); // BUG: 93 } 94 95 void Invader::comboControll() 96 { 97 if (b_combo) 98 multiplier++; 99 else 100 multiplier = 1; 101 b_combo = false; 87 102 } 88 103 -
code/branches/invaders/src/modules/invader/Invader.h
r9828 r9829 66 66 int getLevel(){return this->level;} 67 67 int getPoints(){return this->point;} 68 69 void costLife(){lives--; if (lives == 0) orxout() << "end<<<<<<<<<<<<<<<<<" << endl;}; 70 void levelUp(){level++;} 71 void addPoints(int numPoints){point += numPoints * multiplier; b_combo = true;} 72 void comboControll(); 68 73 private: 69 74 WeakPtr<InvaderCenterPoint> center_; … … 72 77 ConsoleCommand* console_addEnemy; 73 78 Timer enemySpawnTimer; 79 Timer comboTimer; 74 80 //Context* context; 75 81 int lives; 76 82 int level; 77 83 int point; 84 bool b_combo; 85 int multiplier; 78 86 }; 79 87 } -
code/branches/invaders/src/modules/invader/InvaderEnemy.cc
r9828 r9829 58 58 return false; 59 59 } 60 61 WeakPtr<Invader> InvaderEnemy::getGame() 62 { 63 if (game == NULL) 64 { 65 for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it) 66 game = *it; 67 } 68 return game; 69 } 70 71 void InvaderEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 72 { 73 if (getGame()) 74 getGame()->addPoints(42); 75 // SUPER(InvaderEnemy, damage, damage, healthdamage, shielddamage, originator); 76 } 60 77 } -
code/branches/invaders/src/modules/invader/InvaderEnemy.h
r9828 r9829 49 49 virtual void tick(float dt); 50 50 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 51 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator); 51 52 52 53 private: 54 WeakPtr<Invader> getGame(); 55 WeakPtr<Invader> game; 53 56 Camera* camera; 54 57 bool isFireing; -
code/branches/invaders/src/modules/invader/InvaderShip.cc
r9828 r9829 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/XMLPort.h" 38 #include "Invader.h" 38 39 39 40 namespace orxonox … … 120 121 { 121 122 lastTime = 0; 123 if (getGame()) 124 { 125 getGame()->levelUp(); 126 // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype()); 127 128 } 122 129 //level++ 123 130 } … … 151 158 { 152 159 orxout() << "DIED!!!! " << endl; 160 if (getGame()) 161 { 162 getGame()->costLife(); 163 // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype()); 164 165 } 153 166 } 154 167 return false; … … 157 170 // SUPER(InvaderShip, collidesAgainst, otherObject, contactPoint); 158 171 } 172 173 WeakPtr<Invader> InvaderShip::getGame() 174 { 175 if (game == NULL) 176 { 177 for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it) 178 game = *it; 179 } 180 return game; 181 } 159 182 } -
code/branches/invaders/src/modules/invader/InvaderShip.h
r9828 r9829 65 65 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 66 66 private: 67 68 WeakPtr<Invader> getGame(); 69 WeakPtr<Invader> game; 67 70 Camera* camera; 68 71 bool isFireing;
Note: See TracChangeset
for help on using the changeset viewer.