Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 19, 2011, 4:21:48 PM (13 years ago)
Author:
eceline
Message:

Space Race mit countdown

Location:
code/branches/spaceraceTwo/src/modules/gametypes
Files:
2 edited

Legend:

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

    r8858 r8898  
    3434#include "util/Math.h"
    3535
     36#include "items/Engine.h"
     37
    3638namespace orxonox
    3739{
     
    4446        this->bTimeIsUp_ = false;
    4547        this->numberOfBots_ = 0;
     48       
    4649    }
     50   
     51  // void SpaceRace::SetConfigValues(){
     52    //SUPER(Gametype,setConfigValues);
     53    //this->Gametype::SetConfigValue(initialStartCountdown_, 3.0f);}
    4754
    4855    void SpaceRace::end()
     
    8188
    8289    void SpaceRace::start()
    83     {
    84         Gametype::start();
    85 
     90    {   int i=0;
     91        for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)
     92        {this->maxSpeedBack_[i]=it->getMaxSpeedBack();
     93        this->maxSpeedFront_[i]=it->getMaxSpeedFront();
     94        this->maxSpeedLeftRight_[i]=it->getMaxSpeedLeftRight();
     95        this->maxSpeedUpDown_[i]=(it->getMaxSpeedUpDown());
     96       
     97        it->setMaxSpeedBack(0);
     98        it->setMaxSpeedFront(0);
     99        it->setMaxSpeedLeftRight(0);
     100        it->setMaxSpeedUpDown(0);
     101       
     102        i++;
     103        }
     104        //Gametype::start();
     105        this->addBots(this->numberOfBots_);
     106   this->spawnPlayersIfRequested();
     107   
     108       
     109       Gametype::checkStart();
     110       
     111        i=0;
     112     for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)
     113        {
     114        it->setMaxSpeedBack(this->maxSpeedBack_[i]);
     115         it->setMaxSpeedFront(this->maxSpeedFront_[i]);
     116         it->setMaxSpeedLeftRight(this->maxSpeedLeftRight_[i]);
     117         it->setMaxSpeedUpDown(this->maxSpeedUpDown_[i]);
     118         i++;
     119         
     120     
     121        }
     122                delete &this->maxSpeedBack_;
     123                delete &this->maxSpeedFront_;
     124                delete &this->maxSpeedLeftRight_;
     125                delete &this->maxSpeedUpDown_;
    86126        std::string message("The match has started! Reach the check points as quickly as possible!");
    87127        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    88128        ChatManager::message(message);
     129     
    89130    }
     131
     132        void SpaceRace::tick(float dt)
     133        {SUPER(SpaceRace,tick,dt);
     134       
     135       
     136                //if(const_cast<GametypeInfo*>(this->getGametypeInfo())->isStartCountdownRunning()){
     137                //const_cast<GametypeInfo*>(this->getGametypeInfo())->start();}
     138        }
     139       
    90140
    91141    void SpaceRace::newCheckpointReached()
  • code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.h

    r8767 r8898  
    3434#include <set>
    3535#include <string>
     36#include <vector>
    3637
    3738#include <util/Clock.h>
     
    5758            virtual void start();
    5859            virtual void end();
    59 
     60               
    6061            virtual void newCheckpointReached();
    6162
     
    6667            inline void timeIsUp()
    6768                { this->bTimeIsUp_ = true;}
    68 
     69        void tick(float dt);
    6970        protected:
    7071
    7172        private:
     73        std::vector<float> maxSpeedBack_; std::vector<float> maxSpeedFront_; std::vector<float> maxSpeedLeftRight_; std::vector<float> maxSpeedUpDown_;
    7274            int checkpointsReached_; //The current number of check points reached by the player.
    7375            std::set<float> scores_; //The times of the players are saved in a set.
Note: See TracChangeset for help on using the changeset viewer.