Changeset 10156 for code/branches/minigame4DHS14/src
- Timestamp:
- Dec 4, 2014, 5:16:20 PM (10 years ago)
- Location:
- code/branches/minigame4DHS14/src/modules/mini4Dgame
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/minigame4DHS14/src/modules/mini4Dgame/CMakeLists.txt
r10131 r10156 3 3 #Mini4DgameAI.cc 4 4 Mini4DgameBoard.cc 5 Mini4DgameCenterpoint.cc6 5 ) 7 6 -
code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.cc
r10131 r10156 50 50 #include "chat/ChatManager.h" 51 51 52 #include "Mini4DgameCenterpoint.h"53 54 52 namespace orxonox 55 53 { … … 67 65 RegisterObject(Mini4Dgame); 68 66 69 this->center_ = 0;70 67 this->board_ = 0; 68 //ConsoleCommand("Mini4Dgame", "setStone", &Mini4Dgame::setStone).addShortcut().setAsInputCommand(); 71 69 72 70 // Set the type of Bots for this particular Gametype. … … 99 97 void Mini4Dgame::start() 100 98 { 101 if (this-> center_ != NULL) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place.99 if (this->board_ != NULL) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place. 102 100 { 101 /* 103 102 if (this->board_ == NULL) 104 103 { 105 this->board_ = new Mini4DgameBoard(this-> center_->getContext());104 this->board_ = new Mini4DgameBoard(this->board_->getContext()); 106 105 // Apply the template for the ball specified by the centerpoint. 107 106 this->board_->addTemplate(this->center_->getBoardtemplate()); 108 107 } 108 */ 109 109 110 110 // Attach the board to the centerpoint and set the parameters as specified in the centerpoint, the ball is attached to. 111 this->center_->attach(this->board_); 111 112 112 this->board_->setPosition(0, 0, 0); 113 113 … … 177 177 } 178 178 179 static void Mini4Dgame::setStone(Vector4 move, const int playerColor, Mini4DgameBoard* board) 179 //void Mini4Dgame::setStone(Vector4 move, const int playerColor, Mini4DgameBoard* board) 180 void Mini4Dgame::setStone(int x,int y,int z,int w)//Vector4 move, const int playerColor) 180 181 { 181 board->makeMove(move,playerColor); 182 Vector4 move = Vector4(x,y,z,w); 183 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>::begin(); 184 it->makeMove(move,1);//playerColor); 182 185 } 183 186 -
code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.h
r10131 r10156 37 37 #include "gametypes/Deathmatch.h" 38 38 #include "mini4Dgame/Mini4DgamePrereqs.h" 39 #include "Mini4DgameCenterpoint.h"40 39 #include "Mini4DgameBoard.h" 41 40 … … 71 70 virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player. 72 71 73 void set Centerpoint(Mini4DgameCenterpoint* center)74 { this-> center_ = center; }72 void setGameboard(Mini4DgameBoard* board) 73 { this->board_ = board; } 75 74 76 static void setStone(Vector4 move, const int playerColor, Mini4DgameBoard* board); 75 Mini4DgameBoard* getBoard(void) 76 { return this->board_; } 77 78 //static void setStone(Vector4 move, const int playerColor, Mini4DgameBoard* board); 79 static void setStone(int x,int y, int z, int w);//Vector4 move, const int playerColor); 77 80 78 81 void win(Mini4DgameWinner winner); … … 86 89 87 90 //Player players[2]; 88 89 WeakPtr<Mini4DgameCenterpoint> center_; //!< The centerpoint to which the objects are attached 90 WeakPtr<Mini4DgameBoard> board_; 91 Mini4DgameBoard* board_; 91 92 }; 92 93 } -
code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgameBoard.cc
r10131 r10156 38 38 39 39 #include "gametypes/Gametype.h" 40 #include "graphics/BlinkingBillboard.h" 40 41 41 42 #include "core/XMLPort.h" … … 57 58 //this->registerVariables(); 58 59 59 //initialize sound60 //initialize board 60 61 for(int i=0;i<4;i++){ 61 62 for(int j=0;j<4;j++){ … … 67 68 } 68 69 } 70 71 this->checkGametype(); 69 72 } 70 73 … … 123 126 { 124 127 this->board[(int)move.x][(int)move.y][(int)move.z][(int)move.w] = (mini4DgamePlayerColor::color) playerColor; 125 //BlinkingBillboard* bb = new BlinkingBillboard(this->getContext()); 126 //bb->setPosition(0,0,0); 128 BlinkingBillboard* bb = new BlinkingBillboard(this->getContext()); 129 orxout(user_status) << "Mini4Dgame: move.x " << move.x << endl; 130 131 bb->setPosition(60*(int)move.x-90,60*(int)move.y-90,60*(int)move.z-90); 132 bb->setFrequency(0.6); 133 bb->setAmplitude(0.1); 134 //bb->setMaterial("Flares/lensflare"); 135 bb->setMaterial("Numbers/One"); 136 bb->setColour(ColourValue(0,1,0)); 137 138 this->attach(bb); 139 140 127 141 Mini4DgameWinner winner = this->getWinner(); 128 142 if(winner.color_ != mini4DgamePlayerColor::none) 129 143 { 144 orxout(user_status) << "Mini4Dgame: win!!!!!!!" << endl; 130 145 //win(winner); 131 146 } … … 837 852 return winner; 838 853 } 854 855 /** 856 @brief 857 Is called when the gametype has changed. 858 */ 859 void Mini4DgameBoard::changedGametype() 860 { 861 SUPER(Mini4DgameBoard, changedGametype); 862 863 // Check, whether it's still Mini4Dgame. 864 this->checkGametype(); 865 } 866 867 /** 868 @brief 869 Checks whether the gametype is Mini4Dgame and if it is, sets its centerpoint. 870 */ 871 void Mini4DgameBoard::checkGametype() 872 { 873 if (this->getGametype() != NULL && this->getGametype()->isA(Class(Mini4Dgame))) 874 { 875 Mini4Dgame* Mini4DgameGametype = orxonox_cast<Mini4Dgame*>(this->getGametype().get()); 876 Mini4DgameGametype->setGameboard(this); 877 } 878 } 839 879 } -
code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgameBoard.h
r10131 r10156 40 40 #include "worldentities/StaticEntity.h" 41 41 42 #include "Mini4DgameCenterpoint.h"43 44 42 namespace orxonox 45 43 { … … 73 71 Mini4DgameWinner getWinner(); 74 72 73 void changedGametype(); 74 void checkGametype(); 75 75 76 private: 76 77 //void registerVariables(); -
code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgamePrereqs.h
r10131 r10156 70 70 class Mini4Dgame; 71 71 class Mini4DgameBoard; 72 class Mini4DgameCenterpoint;73 72 } 74 73
Note: See TracChangeset
for help on using the changeset viewer.