Changeset 11180 for code/branches/bindermFS16/src/orxonox/LevelManager.cc
- Timestamp:
- May 10, 2016, 12:09:09 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/bindermFS16/src/orxonox/LevelManager.cc
r11173 r11180 52 52 LevelStatus::LevelStatus() 53 53 { 54 this->won = true; 54 this->won = false; 55 this->nextLevels.insert(this->nextLevels.begin(),-1); 55 56 } 56 57 … … 58 59 {} 59 60 60 bool LevelManager::missionactivate(int index) 61 { 62 //check for index level activate... 63 return index-5; 64 } 65 66 void LevelManager::setLevelStatus(int completedLevel) 67 { 68 // allLevelStatus_[completedLevel]=new LevelStatus; 69 } 61 62 //check if index level is activated... 63 int LevelManager::missionactivate(int index) 64 { 65 return index+1; 66 67 68 if (allLevelStatus_[index].won) 69 return 1; 70 71 //check if level is activated 72 for(unsigned int i=1;i<allLevelStatus_.size();i++) 73 { 74 std::vector<int> nextLevels=allLevelStatus_[i].nextLevels; 75 bool won=allLevelStatus_[i].won; 76 if(nextLevels[index]==1&&won) 77 return 1; 78 }; 79 80 //check if level visible but not activated 81 for(unsigned int i=1;i<allLevelStatus_.size();i++) 82 { 83 std::vector<int> nextLevels=allLevelStatus_[i].nextLevels; 84 bool won=allLevelStatus_[i].won; 85 if(nextLevels[index]==2&&won) 86 return 2; 87 }; 88 return false; 89 } 90 91 //updates the won variable of the corresponding LevelStatus in allLevelStatus_ 92 void LevelManager::setLevelStatus(const int completedLevel) 93 { 94 allLevelStatus_[completedLevel].won=true; 95 } 96 97 //build up allLevelStatus 98 //has to be done once per game (not per level) 99 //all connections between the levels are saved in here 100 void LevelManager::buildallLevelStatus() 101 { 102 LevelStatus level; 103 allLevelStatus_.assign (10,level); 104 allLevelStatus_[1].won=true; 105 106 } 107 70 108 71 109 … … 97 135 this->nextLevel_ = this->availableLevels_.begin(); 98 136 99 allLevelStatus_.reserve(1);137 buildallLevelStatus(); 100 138 } 101 139
Note: See TracChangeset
for help on using the changeset viewer.