Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2014, 4:08:42 PM (9 years ago)
Author:
richtero
Message:

new structure: Board in separate class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4Dgame.cc

    r10121 r10131  
    4545#include "core/config/ConfigValueIncludes.h"
    4646#include "infos/PlayerInfo.h"
     47#include "core/command/ConsoleCommand.h"
    4748
    4849#include "gamestates/GSLevel.h"
     
    5354namespace orxonox
    5455{
     56
     57        SetConsoleCommand("Mini4Dgame", "setStone", &Mini4Dgame::setStone).addShortcut();
    5558
    5659    RegisterUnloadableClass(Mini4Dgame);
     
    6568
    6669        this->center_ = 0;
    67         //TODO: player Null setzen
     70        this->board_ = 0;
     71
     72        // Set the type of Bots for this particular Gametype.
     73        //this->botclass_ = Class(Mini4DgameBot);
    6874    }
    6975
     
    8793    }
    8894
    89     /*
    90     bool Mini4Dgame::isValidMove(Vector4* move, const Mini4DgameBoard* board)
    91     {
    92 
    93     }
    94     */
    95 
    96 
    9795    /**
    9896    @brief
    99         Starts the Tetris minigame.
     97        Starts the mini4Dgame.
    10098    */
    10199    void Mini4Dgame::start()
     
    103101        if (this->center_ != NULL) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place.
    104102        {
    105             //TODO: create all objects if they don't exist so far and attach the parameters specified in the centerpoint to them
     103                if (this->board_ == NULL)
     104                {
     105                        this->board_ = new Mini4DgameBoard(this->center_->getContext());
     106                        // Apply the template for the ball specified by the centerpoint.
     107                        this->board_->addTemplate(this->center_->getBoardtemplate());
     108                }
     109
     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_);
     112                this->board_->setPosition(0, 0, 0);
     113
    106114        }
    107115        else // If no centerpoint was specified, an error is thrown and the level is exited.
     
    169177    }
    170178
     179    static void Mini4Dgame::setStone(Vector4 move, const int playerColor, Mini4DgameBoard* board)
     180    {
     181        board->makeMove(move,playerColor);
     182    }
    171183
     184    void Mini4Dgame::win(Mini4DgameWinner winner)
     185    {
     186
     187    }
    172188}
Note: See TracChangeset for help on using the changeset viewer.