Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2014, 5:16:20 PM (10 years ago)
Author:
richtero
Message:

getting closer to a playable version

Location:
code/branches/minigame4DHS14/src/modules/mini4Dgame
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/CMakeLists.txt

    r10131 r10156  
    33  #Mini4DgameAI.cc
    44  Mini4DgameBoard.cc
    5   Mini4DgameCenterpoint.cc
    65)
    76
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.cc

    r10131 r10156  
    5050#include "chat/ChatManager.h"
    5151
    52 #include "Mini4DgameCenterpoint.h"
    53 
    5452namespace orxonox
    5553{
     
    6765        RegisterObject(Mini4Dgame);
    6866
    69         this->center_ = 0;
    7067        this->board_ = 0;
     68        //ConsoleCommand("Mini4Dgame", "setStone", &Mini4Dgame::setStone).addShortcut().setAsInputCommand();
    7169
    7270        // Set the type of Bots for this particular Gametype.
     
    9997    void Mini4Dgame::start()
    10098    {
    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.
    102100        {
     101                /*
    103102                if (this->board_ == NULL)
    104103                {
    105                         this->board_ = new Mini4DgameBoard(this->center_->getContext());
     104                        this->board_ = new Mini4DgameBoard(this->board_->getContext());
    106105                        // Apply the template for the ball specified by the centerpoint.
    107106                        this->board_->addTemplate(this->center_->getBoardtemplate());
    108107                }
     108                */
    109109
    110110                // 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
    112112                this->board_->setPosition(0, 0, 0);
    113113
     
    177177    }
    178178
    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)
    180181    {
    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);
    182185    }
    183186
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.h

    r10131 r10156  
    3737#include "gametypes/Deathmatch.h"
    3838#include "mini4Dgame/Mini4DgamePrereqs.h"
    39 #include "Mini4DgameCenterpoint.h"
    4039#include "Mini4DgameBoard.h"
    4140
     
    7170            virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
    7271
    73             void setCenterpoint(Mini4DgameCenterpoint* center)
    74                 { this->center_ = center; }
     72            void setGameboard(Mini4DgameBoard* board)
     73                { this->board_ = board; }
    7574
    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);
    7780
    7881            void win(Mini4DgameWinner winner);
     
    8689
    8790            //Player players[2];
    88 
    89             WeakPtr<Mini4DgameCenterpoint> center_; //!< The centerpoint to which the objects are attached
    90             WeakPtr<Mini4DgameBoard> board_;
     91            Mini4DgameBoard* board_;
    9192    };
    9293}
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgameBoard.cc

    r10131 r10156  
    3838
    3939#include "gametypes/Gametype.h"
     40#include "graphics/BlinkingBillboard.h"
    4041
    4142#include "core/XMLPort.h"
     
    5758        //this->registerVariables();
    5859
    59         //initialize sound
     60        //initialize board
    6061        for(int i=0;i<4;i++){
    6162                for(int j=0;j<4;j++){
     
    6768                }
    6869        }
     70
     71        this->checkGametype();
    6972    }
    7073
     
    123126        {
    124127                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
    127141                Mini4DgameWinner winner = this->getWinner();
    128142                if(winner.color_ != mini4DgamePlayerColor::none)
    129143                {
     144                        orxout(user_status) << "Mini4Dgame: win!!!!!!!" << endl;
    130145                        //win(winner);
    131146                }
     
    837852        return winner;
    838853    }
     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    }
    839879}
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgameBoard.h

    r10131 r10156  
    4040#include "worldentities/StaticEntity.h"
    4141
    42 #include "Mini4DgameCenterpoint.h"
    43 
    4442namespace orxonox
    4543{
     
    7371            Mini4DgameWinner getWinner();
    7472
     73            void changedGametype();
     74            void checkGametype();
     75
    7576        private:
    7677            //void registerVariables();
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgamePrereqs.h

    r10131 r10156  
    7070    class Mini4Dgame;
    7171    class Mini4DgameBoard;
    72     class Mini4DgameCenterpoint;
    7372}
    7473
Note: See TracChangeset for help on using the changeset viewer.