Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12260


Ignore:
Timestamp:
Mar 28, 2019, 3:49:58 PM (6 years ago)
Author:
ahuwyler
Message:

Changed OrxoBlox.cc

Location:
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc

    r12212 r12260  
    4747#include "OrxoBloxBot.h"
    4848#include "OrxoBloxAI.h"
     49
    4950namespace orxonox
    5051{
     
    6667        this->ball_ = nullptr;
    6768        this->bat_[0] = nullptr;
    68         this->bat_[1] = nullptr;
    6969
    7070        this->setHUDTemplate("OrxoBloxHUD");
     
    157157            this->center_->attach(this->bat_[1]);
    158158            this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
    159             this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
    160159            this->bat_[0]->yaw(Degree(-90));
    161             this->bat_[1]->yaw(Degree(90));
    162160            this->bat_[0]->setSpeed(this->center_->getBatSpeed());
    163             this->bat_[1]->setSpeed(this->center_->getBatSpeed());
    164161            this->bat_[0]->setFieldHeight(this->center_->getFieldDimension().y);
    165             this->bat_[1]->setFieldHeight(this->center_->getFieldDimension().y);
    166162            this->bat_[0]->setLength(this->center_->getBatLength());
    167             this->bat_[1]->setLength(this->center_->getBatLength());
    168163
    169164            // Set the bats for the ball.
     
    235230            this->players_[player].state_ = PlayerState::Alive;
    236231        }
    237         // If the second (right) bat has no player.
    238         else if (this->bat_[1]->getPlayer() == nullptr)
    239         {
    240             player->startControl(this->bat_[1]);
    241             this->players_[player].state_ = PlayerState::Alive;
    242         }
    243         // If both bats are taken.
    244232        else
    245233            return;
     
    264252        {
    265253            // Fire an event for the player that has scored, to be able to react to it in the level, e.g. by displaying fireworks.
    266             if (player == this->getRightPlayer())
    267                 this->center_->fireEvent(FireEventName(OrxoBloxCenterpoint, right));
    268             else if (player == this->getLeftPlayer())
     254           
     255            if (player == this->getLeftPlayer())
    269256                this->center_->fireEvent(FireEventName(OrxoBloxCenterpoint, left));
    270257
     
    287274        {
    288275            this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
    289             this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
     276           
    290277        }
    291278
     
    294281        if (this->getLeftPlayer() && this->getScore(this->getLeftPlayer()) >= scoreLimit_)
    295282            winningPlayer = this->getLeftPlayer();
    296         else if (this->getRightPlayer() && this->getScore(this->getRightPlayer()) >= scoreLimit_)
    297             winningPlayer = this->getRightPlayer();
    298283
    299284        if (winningPlayer)
     
    337322        Returns a pointer to the player playing on the right. If there is no right player, nullptr is returned.
    338323    */
    339     PlayerInfo* OrxoBlox::getRightPlayer() const
    340     {
    341         if (this->bat_[1] != nullptr)
    342             return this->bat_[1]->getPlayer();
    343         else
    344             return nullptr;
    345     }
     324   
    346325}
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h

    r12212 r12260  
    9494            WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field.
    9595            WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
    96             WeakPtr<OrxoBloxBat> bat_[2]; //!< The two bats.
     96            WeakPtr<OrxoBloxBat> bat_[1]; //!< The two bats.
    9797            Timer starttimer_; //!< A timer to delay the start of the game.
    9898            int scoreLimit_; //!< If a player scored that much points, the game is ended.
Note: See TracChangeset for help on using the changeset viewer.