Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 25, 2009, 3:26:06 AM (15 years ago)
Author:
landauf
Message:

added AI for the Pong gametype
improved Pong gameplay

Location:
code/trunk/src/orxonox/objects/gametypes
Files:
3 edited

Legend:

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

    r2826 r2839  
    200200                // Reward killer
    201201                if (killer)
    202                     this->playerScored(killer->getPlayer());
     202                {
     203                    std::map<PlayerInfo*, Player>::iterator it = this->players_.find(killer->getPlayer());
     204                    if (it != this->players_.end())
     205                        it->second.frags_++;
     206                }
    203207
    204208                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator());
     
    348352    {
    349353        for (unsigned int i = 0; i < amount; ++i)
    350             new Bot(this);
     354            this->botclass_.fabricate(this);
    351355    }
    352356
  • code/trunk/src/orxonox/objects/gametypes/Gametype.h

    r2826 r2839  
    142142            float initialStartCountdown_;
    143143            unsigned int numberOfBots_;
     144            SubclassIdentifier<Bot> botclass_;
    144145
    145146            std::map<PlayerInfo*, Player> players_;
  • code/trunk/src/orxonox/objects/gametypes/Pong.cc

    r2826 r2839  
    3737#include "objects/worldentities/PongBall.h"
    3838#include "objects/worldentities/PongBat.h"
    39 #include "objects/infos/PlayerInfo.h"
     39#include "objects/infos/HumanPlayer.h"
     40#include "objects/infos/PongBot.h"
     41#include "objects/controllers/PongAI.h"
    4042
    4143namespace orxonox
     
    5658        this->starttimer_.setTimer(1.0, false, this, createExecutor(createFunctor(&Pong::startBall)));
    5759        this->starttimer_.stopTimer();
     60
     61        this->botclass_ = Class(PongBot);
    5862    }
    5963
     
    133137            this->players_[player].state_ = PlayerState::Alive;
    134138        }
     139        else
     140            return;
     141
     142        if (player && player->getController() && player->getController()->isA(Class(PongAI)))
     143        {
     144            PongAI* ai = dynamic_cast<PongAI*>(player->getController());
     145            ai->setPongBall(this->ball_);
     146        }
    135147    }
    136148
Note: See TracChangeset for help on using the changeset viewer.