Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 2, 2009, 8:42:11 PM (15 years ago)
Author:
landauf
Message:
  • Added overlay element for the Pong Gametype
  • Changed the type of the overlay's owner to BaseObject (former ControllableEntity) to allow other classes to own an overlay (for example a Gametype)
  • OverlayGroup does now use a std::set instead of a std::map to store it's overlay elements. Therefore a name is not anymore compulsory for an overlay element.
Location:
code/trunk/src/orxonox/objects/gametypes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/gametypes/Gametype.cc

    r2839 r2890  
    229229        if (it != this->players_.end())
    230230            it->second.frags_++;
     231    }
     232
     233    int Gametype::getScore(PlayerInfo* player) const
     234    {
     235        std::map<PlayerInfo*, Player>::const_iterator it = this->players_.find(player);
     236        if (it != this->players_.end())
     237            return it->second.frags_;
     238        else
     239            return 0;
    231240    }
    232241
  • code/trunk/src/orxonox/objects/gametypes/Gametype.h

    r2839 r2890  
    107107                { return this->players_; }
    108108
     109            int getScore(PlayerInfo* player) const;
     110
    109111            inline void registerSpawnPoint(SpawnPoint* spawnpoint)
    110112                { this->spawnpoints_.insert(spawnpoint); }
  • code/trunk/src/orxonox/objects/gametypes/Pong.cc

    r2885 r2890  
    5353        this->bat_[0] = 0;
    5454        this->bat_[1] = 0;
     55
     56        this->setHUDTemplate("PongHUD");
    5557
    5658        this->starttimer_.setTimer(1.0, false, this, createExecutor(createFunctor(&Pong::startBall)));
     
    181183            this->ball_->setSpeed(this->center_->getBallSpeed());
    182184    }
     185
     186    PlayerInfo* Pong::getLeftPlayer() const
     187    {
     188        if (this->bat_ && this->bat_[0])
     189            return this->bat_[0]->getPlayer();
     190        else
     191            return 0;
     192    }
     193
     194    PlayerInfo* Pong::getRightPlayer() const
     195    {
     196        if (this->bat_ && this->bat_[1])
     197            return this->bat_[1]->getPlayer();
     198        else
     199            return 0;
     200    }
    183201}
  • code/trunk/src/orxonox/objects/gametypes/Pong.h

    r2826 r2890  
    5353                { this->center_ = center; }
    5454
     55            PlayerInfo* getLeftPlayer() const;
     56            PlayerInfo* getRightPlayer() const;
     57
    5558        protected:
    5659            void startBall();
Note: See TracChangeset for help on using the changeset viewer.