Changeset 11783 for code/trunk/src/modules/superorxobros/SOB.cc
- Timestamp:
- Feb 20, 2018, 12:14:40 AM (7 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/superorxobros/SOB.cc
- Property svn:eol-style set to native
r11418 r11783 44 44 #include "SOBFigure.h" 45 45 #include "graphics/Camera.h" 46 #include "Highscore.h" 46 47 47 48 … … 49 50 namespace orxonox 50 51 { 51 52 bool newHighscore=0; 52 53 RegisterUnloadableClass(SOB); 53 54 … … 59 60 { 60 61 RegisterObject(SOB); 61 camera = nullptr;62 62 63 63 this->center_ = nullptr; … … 68 68 timeLeft_=400.0; 69 69 done_ = true; 70 newHighscore = false; 70 71 lvl_ = 1; 71 72 … … 78 79 SOB::~SOB() 79 80 { 80 if (this->isInitialized())81 this->cleanup();82 81 } 83 84 void SOB::cleanup()85 {86 camera = nullptr;87 }88 89 90 82 91 83 void SOB::start() … … 99 91 } 100 92 101 center_->attach(figure_);102 93 figure_->setPosition(0, 0, 0); 103 94 } … … 112 103 Gametype::start(); 113 104 114 if (figure_ != nullptr)115 {116 camera = figure_->getCamera();117 }118 119 105 } 120 106 121 107 void SOB::end() 122 108 { 123 cleanup();124 109 GSLevel::startMainMenu(); 125 110 Deathmatch::end(); 126 111 } 127 112 128 113 void SOB::restart() { 129 cleanup();130 131 114 // HACK - only method I found to simply reload the level 132 115 Game::getInstance().popState(); … … 167 150 if (this->figure_ != nullptr && figure_->lvlEnded_) { 168 151 std::stringstream a; 169 a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart"; 152 if(!newHighscore){ 153 a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart"; 154 } 155 else{ 156 a << "Congrats, new Highscore! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart"; 157 } 170 158 info_ =a.str(); 171 159 … … 181 169 //The time on the HUD 182 170 if (!done_) 183 timeLeft_-=dt*2.5 ;171 timeLeft_-=dt*2.5f; 184 172 } 185 173
Note: See TracChangeset
for help on using the changeset viewer.