Changeset 12359
- Timestamp:
- May 9, 2019, 3:29:29 PM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
r12341 r12359 91 91 <?lua include("includes/notifications.oxi") ?> 92 92 93 <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true"/>94 95 93 96 94 <Scene … … 105 103 106 104 107 <MovableEntity rotationrate=0 rotationaxis="0,0,1"> 105 <OrxoBloxCenterpoint name=OrxoBloxcenter dimension="90,100" balltemplate=OrxoBloxball battemplate=OrxoBloxbat ballspeed=200 ballaccfactor=1.0 batspeed=130 batlength=0.25 StoneTemplate=OrxoBloxstone WallTemplate=OrxoBloxwall position="-55,-75,0"> 106 108 107 <attached> 109 <OrxoBloxCenterpoint name=OrxoBloxcenter dimension="90,100" balltemplate=OrxoBloxball battemplate=OrxoBloxbat ballspeed=200 ballaccfactor=1.0 batspeed=130 batlength=0.25 StoneTemplate=OrxoBloxstone WallTemplate=OrxoBloxwall>110 111 <attached>112 108 <!-- Balken die das Spielfeld begrenzen. --> 113 <Model position="0,0,-49" mesh="cube.mesh" scale3D="45,1,1" /> 114 <Model position="46,0,0" mesh="cube.mesh" scale3D="1,1,50"/> 115 <Model position="-46,0,0" mesh="cube.mesh" scale3D="1,1,50"/> 116 </attached> 117 </OrxoBloxCenterpoint> 109 <Model position="0,0,-49" mesh="cube.mesh" scale3D="45,1,1" /> 110 <Model position="46,0,0" mesh="cube.mesh" scale3D="1,1,50"/> 111 <Model position="-46,0,0" mesh="cube.mesh" scale3D="1,1,50"/> 118 112 </attached> 119 </MovableEntity> 113 </OrxoBloxCenterpoint> 114 120 115 </Scene> 121 116 </Level> -
code/branches/OrxoBlox_FS19/data/overlays/OrxoBloxHUD.oxo
r12268 r12359 2 2 <OverlayGroup name="OrxoBloxHUD" scale = "1, 1"> 3 3 <OrxoBloxScore 4 position = "0. 05, 0.05"4 position = "0.9, 0.2" 5 5 pickpoint = "0.0, 0.0" 6 6 font = "ShareTechMono" 7 textsize = 0.06 7 textsize = 0.05 8 colour = "1.0, 1.0, 1.0, 1.0" 9 align = "left" 10 /> 11 12 <OverlayText 13 position = "0.7, 0.20" 14 pickpoint = "0.0, 0.0" 15 font = "ShareTechMono" 16 textsize = 0.05 8 17 colour = "1.0, 1.0, 1.0, 1.0" 9 18 align = "left" 10 19 11 showleftplayer = true 12 showrightplayer = false 13 showname = true 14 showscore = false 20 caption = "Points: " 15 21 /> 16 22 17 <OrxoBloxScore18 position = "0.49, 0.05"19 pickpoint = "0.0, 0.0"20 font = "ShareTechMono"21 textsize = 0.0622 colour = "1.0, 1.0, 1.0, 1.0"23 align = "right"24 25 showleftplayer = true26 showrightplayer = false27 showname = false28 showscore = true29 />30 31 <OverlayText32 position = "0.505, 0.05"33 pickpoint = "0.0, 0.0"34 font = "ShareTechMono"35 textsize = 0.0636 colour = "1.0, 1.0, 1.0, 1.0"37 align = "center"38 39 caption = ":"40 />41 42 <OrxoBloxScore43 position = "0.51, 0.05"44 pickpoint = "0.0, 0.0"45 font = "ShareTechMono"46 textsize = 0.0647 colour = "1.0, 1.0, 1.0, 1.0"48 align = "left"49 50 showleftplayer = false51 showrightplayer = true52 showname = false53 showscore = true54 />55 56 <OrxoBloxScore57 position = "0.95, 0.05"58 pickpoint = "0.0, 0.0"59 font = "ShareTechMono"60 textsize = 0.0661 colour = "1.0, 1.0, 1.0, 1.0"62 align = "right"63 64 showleftplayer = false65 showrightplayer = true66 showname = true67 showscore = false68 />69 23 </OverlayGroup> 70 24 </Template> -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
r12355 r12359 170 170 171 171 // Set variable to temporarily force the player to spawn. 172 // Set variable to temporarily force the player to spawn. 173 bool temp = this->bForceSpawn_; 172 174 this->bForceSpawn_ = true; 173 175 … … 175 177 Deathmatch::start(); 176 178 179 // Reset the variable. 180 this->bForceSpawn_ = temp; 181 177 182 } 178 183 … … 184 189 { 185 190 ChatManager::message("You suck!!"); 191 192 if (Highscore::exists()) 193 { 194 int score = this->getScore(this->getPlayer()); 195 Highscore::getInstance().storeScore("Tetris", score, this->getPlayer()); 196 } 197 186 198 this->cleanup(); 187 199 … … 191 203 } 192 204 193 OrxoBloxShip* OrxoBlox::getPlayer() 194 { 195 if (playership == nullptr) 196 { 197 for (OrxoBloxShip* ship_ : ObjectList<OrxoBloxShip>()) 198 { 199 playership = ship_; 200 } 201 } 202 return playership; 205 PlayerInfo* OrxoBlox::getPlayer() 206 { 207 return this->player_; 203 208 } 204 209 … … 217 222 void OrxoBlox::LevelUp(){ 218 223 level_++; 219 224 this->playerScored(this->player_);// add points 220 225 for(OrxoBloxStones* stone : this->stones_){ 221 226 int x_=(stone->getPosition()).x; -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
r12346 r12359 73 73 virtual void end() override; ///!< Ends the OrxoBlox minigame. 74 74 75 OrxoBloxShip* getPlayer();75 PlayerInfo* getPlayer(); 76 76 void spawnPlayer(PlayerInfo* Player) override; 77 77 -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
r12331 r12359 74 74 class OrxoBloxStones; 75 75 class OrxoBloxShip; 76 class OrxoBloxScore; 76 77 } 77 78 -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxScore.cc
r12266 r12359 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/XMLPort.h"38 37 #include "util/Convert.h" 39 38 … … 41 40 42 41 #include "OrxoBlox.h" 43 #include "sound/WorldSound.h" /////////////////////////////44 42 45 43 namespace orxonox … … 56 54 57 55 this->owner_ = nullptr; 58 59 this->bShowName_ = true; 60 this->bShowScore_ = true; 61 this->bShowPlayer_ = true; 62 } 56 this->player_ = nullptr; 63 57 64 58 /** … … 70 64 } 71 65 72 /** 73 @brief 74 Method to create a OrxoBloxScore through XML. 75 */ 76 void OrxoBloxScore::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 { 78 SUPER(OrxoBloxScore, XMLPort, xmlelement, mode); 79 80 XMLPortParam(OrxoBloxScore, "showname", setShowName, getShowName, xmlelement, mode).defaultValues(false); 81 XMLPortParam(OrxoBloxScore, "showscore", setShowScore, getShowScore, xmlelement, mode).defaultValues(false); 82 XMLPortParam(OrxoBloxScore, "showplayer", setShowPlayer, getShowPlayer, xmlelement, mode).defaultValues(false); 83 } 84 66 85 67 /** 86 68 @brief … … 97 79 if (this->owner_ != nullptr) 98 80 { 99 if (!this->owner_->hasEnded()) 81 std::string score("0"); 82 if(!this->owner_->hasEnded()) 100 83 { 101 // Get the player. 102 //Fehlermeldung 103 //player1_ = this->owner_->getPlayer(); 84 //get the player 85 player_ = this->owner_->getPlayer(); 104 86 } 105 87 106 std::string name1; 107 108 std::string score1("0"); 109 110 // Save the name and score of each player as a string. 111 if (player1_ != nullptr) 88 if(this->owner_->hasStarted()) 112 89 { 113 name1 = player1_->getName(); 114 score1 = multi_cast<std::string>(this->owner_->getScore(player1_)); 90 // Save the name and score of each player as a string. 91 if (player_ != nullptr) 92 score = multi_cast<std::string>(this->owner_->getScore(player_)); 115 93 } 116 117 // Assemble the strings, depending on what should all be displayed. 118 std::string output1; 119 if (this->bShowPlayer_) 120 { 121 if (this->bShowName_ && this->bShowScore_ && player1_ != nullptr) 122 output1 = name1 + " - " + score1; 123 else if (this->bShowScore_) 124 output1 = score1; 125 else if (this->bShowName_) 126 output1 = name1; 127 } 128 129 std::string output("OrxoBlox"); 130 /* Keine Ahnung wofuer das gut ist. 131 132 if (this->bShowName_ || this->bShowScore_) 133 { 134 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_) 135 output = output1 + ':' + output2; 136 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_) 137 output = output1 + output2; 138 }*/ 139 140 this->setCaption(output); 94 this->setCaption(score); 141 95 } 142 96 } -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxScore.h
r12266 r12359 61 61 62 62 virtual void tick(float dt) override; //!< Creates and sets the caption to be displayed by the OrxoBloxScore. 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;64 63 virtual void changedOwner() override; //!< Is called when the owner changes. 65 64 66 /**67 @brief Set whether the OrxoBloxScore displays the players' names.68 @param value If true the players' names are displayed.69 */70 inline void setShowName(bool value)71 { this->bShowName_ = value; }72 /**73 @brief Get whether the OrxoBloxScore displays the players' names.74 @return Returns true if the players' names are displayed, false otherwise.75 */76 inline bool getShowName() const77 { return this->bShowName_; }78 65 79 /**80 @brief Set whether the OrxoBloxScore displays the players' scores.81 @param value If true the players' scores are displayed.82 */83 inline void setShowScore(bool value)84 { this->bShowScore_ = value; }85 /**86 @brief Get whether the OrxoBloxScore displays the players' scores.87 @return Returns true if the players' scores are displayed, false otherwise.88 */89 inline bool getShowScore() const90 { return this->bShowScore_; }91 92 /**93 @brief Set whether the OrxoBloxScore displays the left player.94 @param value If true the left player is displayed.95 */96 inline void setShowPlayer(bool value)97 { this->bShowPlayer_ = value; }98 /**99 @brief Get whether the OrxoBloxScore displays the left player.100 @return Returns true if the left player is displayed, false otherwise.101 */102 inline bool getShowPlayer() const103 { return this->bShowPlayer_; }104 105 /*106 /**107 @brief Set whether the OrxoBloxScore displays the right player.108 @param value If true the right player is displayed.109 110 inline void setShowRightPlayer(bool value)111 { this->bShowRightPlayer_ = value; }112 /**113 @brief Get whether the OrxoBloxScore displays the right player.114 @return Returns true if the right player is displayed, false otherwise.115 116 inline bool getShowRightPlayer() const117 { return this->bShowRightPlayer_; }118 */119 66 private: 120 67 OrxoBlox* owner_; //!< The OrxoBlox game that owns this OrxoBloxScore. 121 bool bShowName_; //!< Whether the names of the players are shown. 122 bool bShowScore_; //!< Whether the score of the players is shown. 123 bool bShowPlayer_; //!< Whether the left player is shown. 124 //bool bShowRightPlayer_; //!< Whether the right player is shown. 125 WeakPtr<PlayerInfo> player1_; //!< Store information about left player permanently. 126 WeakPtr<PlayerInfo> player2_; //!< Same for the right player. To end the game properly. 127 WorldSound* scoreSound_; 128 68 PlayerInfo* player_; //!< Store information about the player permanently. 129 69 }; 130 70 }
Note: See TracChangeset
for help on using the changeset viewer.