Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 14, 2016, 1:37:01 PM (7 years ago)
Author:
bberabi
Message:

bots addiert checkpoint problem gelost

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc

    r11246 r11281  
    2929#include "SpaceRace.h"
    3030
     31#include "core/CoreIncludes.h"
     32#include "chat/ChatManager.h"
     33#include "util/Convert.h"
     34#include "util/Math.h"
     35#include "infos/Bot.h"
     36#include "items/Engine.h"
     37#include "controllers/HumanController.h"
     38
     39#include "core/CoreIncludes.h"
     40#include "chat/ChatManager.h"
     41#include "infos/PlayerInfo.h"
     42#include "worldentities/pawns/Pawn.h"
     43#include "core/config/ConfigValueIncludes.h"
     44#include "infos/Bot.h"
     45#include "SpaceRaceBot.h"
    3146#include "items/Engine.h"
    3247
     
    4964        this->cantMove_ = false;
    5065        this->bTimeIsUp_ = false;
    51         this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
     66        this->setConfigValues();
     67
     68       // this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
    5269                                 // remove this line, if a raceBot has been created.
    5370    }
    5471
    55 
    56 
     72  void SpaceRace::setConfigValues()
     73    {
     74       
     75   
     76    }
     77
     78    void SpaceRace::start()
     79    {
     80        Gametype::start();
     81
     82   if (true)
     83        {
     84            this->spawnPlayersIfRequested();
     85            this->cantMove_ = true;
     86
     87            for (Engine* engine : ObjectList<Engine>()){
     88                engine->setActive(false);
     89               
     90
     91            }
     92           
     93        }
     94
     95
     96
     97        std::string message("BE FAST BE FIRST");
     98        this->getGametypeInfo()->sendAnnounceMessage(message);
     99        ChatManager::message(message);
     100
     101Timer* countdownTimer = new Timer();
     102        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
     103    }
    57104
    58105
     
    84131    }
    85132
    86    
    87 
    88 
    89 
    90 
    91     void SpaceRace::tick(float dt)
     133
     134void SpaceRace::tick(float dt)
    92135    {
    93136        SUPER(SpaceRace,tick,dt);
     137
     138
    94139
    95140        // spawns the players when the countdown starts, but deactivates their engines
     
    103148        }
    104149
     150
     151gtInfo_->setStartCountdown(10.0);
     152   
     153       
     154            /*this->spawnPlayersIfRequested();
     155            this->cantMove_ = true;
     156
     157            for (Engine* engine : ObjectList<Engine>()){
     158                engine->setActive(false);
     159                }
     160
     161           
     162           
     163         std::string message("BE FAST BE FIRST");
     164        this->getGametypeInfo()->sendAnnounceMessage(message);
     165        ChatManager::message(message);
     166
     167Timer* countdownTimer = new Timer();
     168        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));*/
     169
     170
     171
     172
     173
     174
     175
    105176        // activate the engines when the countdown ends
    106177        if (!this->isStartCountdownRunning() && this->cantMove_)
     
    113184
    114185
    115             std::string message = "Hello!";
     186            std::string message = "RACE STARTED!";
    116187            this->getGametypeInfo()->sendAnnounceMessage(message);
    117188            ChatManager::message(message);
    118189        }
    119     }
    120 
    121 
    122 
    123 
    124 
     190   
     191}
    125192
    126193    void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
     
    138205    }
    139206
     207 void SpaceRace::countdownFinished()
     208    {
     209
     210        std::string message("RACE STARTED ");
     211        this->getGametypeInfo()->sendAnnounceMessage(message);
     212        ChatManager::message(message);
     213
     214
     215    for (Engine* engine : ObjectList<Engine>())
     216                engine->setActive(true);
     217   
     218}
     219
     220 void SpaceRace::playerEntered(PlayerInfo* player)
     221    {
     222        Gametype::playerEntered(player);
     223
     224        const std::string& message = player->getName() + " entered the game";
     225        ChatManager::message(message);
     226    }
     227
     228
     229 void SpaceRace::addBots(unsigned int amount)
     230    {
     231        for (unsigned int i = 0; i < amount; ++i)
     232            this->botclass_.fabricate(this->getContext());
     233    }
     234
     235
     236
     237
     238
     239
     240
    140241    bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
    141242    {
Note: See TracChangeset for help on using the changeset viewer.