Changeset 11169 for code/branches/tgidronFS16/src/modules/hover
- Timestamp:
- Apr 17, 2016, 8:40:05 PM (9 years ago)
- Location:
- code/branches/tgidronFS16/src/modules/hover
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tgidronFS16/src/modules/hover/Hover.cc
r11168 r11169 98 98 for(int y=0; y<numCells; y++){ 99 99 for(int x=0; x<numCells; x++){ 100 switch(levelcode[ y * numCells + x ]){ 100 switch(levelcode[ y * numCells + x ]) 101 { 101 102 case 1: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1); 102 103 break; 103 104 case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1); 104 105 case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0); 105 default: break; 106 default: 107 break; 106 108 } 107 } 109 } 108 110 } 109 111 … … 120 122 for (int i = 0; i<5; i++) 121 123 { 122 PickupSpawner* pickup = new PickupSpawner(origin_->getContext()); 123 pickup->setPosition(rand()%numCells, rand()%numCells, cellSize); 124 //pickup->setPickupTemplateName(origin_->getPickupMeta()); 125 //pickup->setPickupTemplateName("destroymetapickup"); 126 pickup->setMaxSpawnedItems(5); 127 pickup->setRespawnTime(30); 128 pickup->setTriggerDistance(5); 129 //pickup->createDroppedPickup(this->getContext(), pickup , this, 5); 130 pickups_.push_back(pickup); 131 } 132 133 124 PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext()); 125 126 pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f)); 127 pickupSpawner->setPickupTemplateName(origin_->getPickupTemplate()); 128 pickupSpawner->setMaxSpawnedItems(5); 129 pickupSpawner->setRespawnTime(30); 130 pickupSpawner->setTriggerDistance(5); 131 // Add pickup spawner to the pickup spawner list 132 pickupSpawners_.push_back(pickupSpawner); 133 } 134 135 orxout() << this->origin_->getPickupTemplate() << endl; 136 orxout() << this->origin_->getPickupRepresentationTemplate() << endl; 134 137 } 135 138 } 136 139 137 140 138 139 void Hover::startLevel(){ 141 // Rename/delete this function. 142 void Hover::startLevel() 143 { 140 144 //Generate 5 flags randomly (test only 1 flag) 141 145 for ( int i = 0; i < 5; i++ ) … … 152 156 //PickupSpawner->setPosition(rand()%numCells, rand()%numCells, cellSize); 153 157 //pickup->createDroppedPickup(this->getContext(), pickup , this, 5); 154 pickups_.push_back(pickup); 155 } 156 158 pickupSpawners_.push_back(pickup); 159 } 160 161 157 162 } 158 163 … … 163 168 164 169 // Check if ship collided with one of the flags 165 for ( unsigned int i = 0; i < flags_.size(); i++ ){ 166 if(flags_[i]->getCollided()){ 170 for ( unsigned int i = 0; i < flags_.size(); i++ ) 171 { 172 if(flags_[i]->getCollided()) 173 { 167 174 flags_[i]->destroyLater(); 168 175 flags_.erase (flags_.begin()+i); … … 186 193 187 194 } 195 196 Vector3 Hover::get3dCoordinates(int x, int y, float heightOffset) 197 { 198 return Vector3(x*cellSize*1.0f + cellSize/2, heightOffset, y*cellSize*1.0f + cellSize/2); 199 } 188 200 } -
code/branches/tgidronFS16/src/modules/hover/Hover.h
r11168 r11169 61 61 void endLevel(); 62 62 63 64 65 63 inline int getNumberOfFlags() const 66 64 { return this->numberOfFlags_; } 65 66 virtual Vector3 get3dCoordinates(int x, int y, float heightOffset); 67 67 68 68 private: … … 81 81 int totFlags; 82 82 83 std::vector<PickupSpawner*> pickup s_;83 std::vector<PickupSpawner*> pickupSpawners_; 84 84 }; 85 85 } -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc
r11168 r11169 45 45 RegisterObject(HoverOrigin); 46 46 checkGametype(); 47 48 pickupTemplate_ = ""; 49 pickupRepresentationTemplate_ = ""; 47 50 } 48 51 … … 54 57 XMLPortParam(HoverOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode); 55 58 XMLPortParam(HoverOrigin, "cellHeight", setCellHeight, getCellHeight, xmlelement, mode); 56 XMLPortParam(HoverOrigin, "pickuptemplate", setPickup , getPickup, xmlelement, mode);57 XMLPortParam(HoverOrigin, "pickup base", setPickupMeta, getPickupMeta, xmlelement, mode);59 XMLPortParam(HoverOrigin, "pickuptemplate", setPickupTemplate, getPickupTemplate, xmlelement, mode); 60 XMLPortParam(HoverOrigin, "pickuprepresentationtemplate", setPickupRepresentationTemplate, getPickupRepresentationTemplate, xmlelement, mode); 58 61 } 59 62 -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h
r11168 r11169 66 66 { return this->cellHeight_; } 67 67 68 inline void setPickup (std::string pickuptemplate)69 { this->pickupTemplate_ = pickup template; }70 inline std::string getPickup () const68 inline void setPickupTemplate(std::string pickupTemplate) 69 { this->pickupTemplate_ = pickupTemplate; } 70 inline std::string getPickupTemplate() const 71 71 { return this->pickupTemplate_; } 72 72 73 inline void setPickup Meta(std::string pickupbase)74 { this->pickup Meta_ = pickupbase; }75 inline std::string getPickup Meta() const76 { return this->pickup Meta_; }73 inline void setPickupRepresentationTemplate(std::string pickupRepresenationaTemplate) 74 { this->pickupRepresentationTemplate_ = pickupRepresenationaTemplate; } 75 inline std::string getPickupRepresentationTemplate() const 76 { return this->pickupRepresentationTemplate_; } 77 77 78 78 private: … … 82 82 int cellSize_; 83 83 int cellHeight_; 84 85 // Tempaltes for the destroy hover pickup 84 86 std::string pickupTemplate_; 85 std::string pickup Meta_;87 std::string pickupRepresentationTemplate_; 86 88 }; 87 89 }
Note: See TracChangeset
for help on using the changeset viewer.