Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8934


Ignore:
Timestamp:
Nov 16, 2011, 2:07:17 PM (13 years ago)
Author:
eceline
Message:

spaceracemanager

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

Legend:

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

    r8928 r8934  
    3636#include "SpaceRace.h"
    3737
    38 
    3938namespace orxonox
    4039{
     
    4847        this->bIsLast_ = false;
    4948        this->bTimeLimit_ = 0;
     49        this->isVisible_=false;
    5050
    5151        this->setRadarObjectColour(ColourValue::Blue);
     
    7070        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
    7171        assert(gametype);
    72         this->setRadarVisibility(false);
     72        if(this->isVisible_){this->setRadarVisibility(true);}
     73        else{this->setRadarVisibility(false);}
     74        /*this->setRadarVisibility(false);
    7375        Vector3 v =Vector3(0,0,0);
    7476        int j=0;
     
    8183                if (this->getCheckpointIndex() == v[i])
    8284                 this->setRadarVisibility(true);
    83                  }
    84         }     
     85                 }*/
     86        //}     
    8587    }
    8688
     
    9597    }
    9698
    97 
    98 
    99     void RaceCheckPoint::triggered(bool bIsTriggered, PlayerInfo* player)
     99        void RaceCheckPoint::triggered(bool bIsTriggered, PlayerInfo* player)
    100100    {
    101101        DistanceTrigger::triggered(bIsTriggered);
  • code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h

    r8928 r8934  
    6161           inline const Vector3& getNextcheckpoint() const
    6262                {return this->nextcheckpoints_;}
     63
     64        inline void setVisibility(bool b)
     65                {this->isVisible_ = b;}
    6366        protected:
    6467            virtual void triggered(bool bIsTriggered, PlayerInfo* player);
     
    8487       
    8588        Vector3 nextcheckpoints_; //the indexes of the next check points
     89
     90        bool isVisible_;
    8691     
    8792    };
  • code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc

    r8928 r8934  
    4545    {
    4646        RegisterObject(SpaceRace);
    47         //this->checkpointsReached_ = 0;
     47        this->checkpointReached_ = 0;
    4848        this->bTimeIsUp_ = false;
    4949        this->numberOfBots_ = 0;
     
    139139       
    140140
    141     void SpaceRace::newCheckpointReached(RaceCheckPoint* p)
     141    void SpaceRace::newCheckpointReached(SpaceRaceManager* p, int index)
    142142    {
    143         this->checkpointReached_=p->getCheckpointIndex();
     143        this->checkpointReached_=index;
    144144        this->clock_.capture();
    145145        int s = this->clock_.getSeconds();
    146146        int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
    147         const std::string& message = "Checkpoint " + multi_cast<std::string>(p)
     147        const std::string& message = "Checkpoint " + multi_cast<std::string>(index)
     148                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
     149                        + " seconds.";
     150        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     151        ChatManager::message(message);
     152       
     153       
     154    }
     155   
     156     void SpaceRace::newCheckpointReached(RaceCheckPoint* p)
     157    {   int index = p->getCheckpointIndex();
     158        this->checkpointReached_=index;
     159        this->clock_.capture();
     160        int s = this->clock_.getSeconds();
     161        int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
     162        const std::string& message = "Checkpoint " + multi_cast<std::string>(index)
    148163                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
    149164                        + " seconds.";
  • code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.h

    r8928 r8934  
    4040#include "gametypes/Gametype.h"
    4141
    42 #include "RaceCheckPoint.h"
     42
     43
     44#include "SpaceRaceManager.h"
    4345
    4446namespace orxonox
     
    5153    {
    5254        friend class RaceCheckPoint;
     55        friend class SpaceRaceManager;
    5356
    5457        public:
     
    5962            virtual void end();
    6063               
    61             virtual void newCheckpointReached(RaceCheckPoint* p);
     64            virtual void newCheckpointReached(SpaceRaceManager* p, int index);
     65                virtual void newCheckpointReached(RaceCheckPoint* p);
    6266
    6367            inline void setCheckpointReached(int n)
  • code/branches/spaceraceTwo/src/modules/gametypes/SpaceRaceManager.cc

    r8928 r8934  
    2828
    2929#include "SpaceRaceManager.h"
    30 
     30#include "SpaceRace.h"
    3131
    3232#include "core/XMLPort.h"
     
    8080    {
    8181    SUPER(SpaceRaceManager,tick,dt);
    82            
     82     SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
     83           Vector3 v =Vector3(0,0,0);
     84        int j=0;
     85        for (std::map<PlayerInfo*, Player>::iterator it = gametype->players_.begin(); it != gametype->players_.end(); ++it)
     86        {
     87                j=gametype->getCheckpointReached(it->first);
     88                RaceCheckPoint* r=this->getCheckpoint(j);
     89                v=r->getNextcheckpoint();
     90                for(int i=1;i<4;i++){
     91                 RaceCheckPoint* n=this->getCheckpoint(i);
     92                 n->setVisibility(true);
     93                 }
     94        }
     95     
    8396    }
    84      
    85    
    86    
    87    
    88    
    89    
    90     }
     97}
    9198
    9299
Note: See TracChangeset for help on using the changeset viewer.