Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2011, 6:07:32 PM (13 years ago)
Author:
eceline
Message:

added waypoint patrol controller to level, RaceCheckPoint::fire works now

File:
1 edited

Legend:

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

    r8959 r8968  
    2121 *
    2222 *   Author:
    23  *     Mauro Salomon
     23 *     Celine Eggenberger
    2424 *   Co-authors:
    2525 *      ...
     
    3838#include "util/Math.h"
    3939
     40
     41
    4042namespace orxonox
    4143{
     
    4648        RegisterObject(SpaceRaceManager);
    4749         
    48          for (size_t i = 0; i < this->checkpoints_.size(); ++i)
    49                 this->setNext(this->checkpoints_[i]);
    50          
     50        this->firstcheckpointvisible_=false;
     51         
    5152    }
    5253
     
    9596    {
    9697    SUPER(SpaceRaceManager,tick,dt);
    97      SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
    98      gametype->setV(this);
    99          
     98     
     99     if(this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_)
     100         {this->checkpoints_[0]->setRadarVisibility(true);this->firstcheckpointvisible_=false;}
    100101         
    101102         for (size_t i = 0; i < this->checkpoints_.size(); ++i){
     
    111112        assert(gametype);
    112113       
    113         //if(gametype->getCheckpointReached(player)==-1) {orxout()<<"index -1"<<endl;}
     114       
    114115   
    115116                 bool b =false;
    116                 //DistanceMultiTrigger::fire(bIsTriggered,player);
     117               
    117118                int index=gametype->getCheckpointReached(player);
     119                Vector3 v=Vector3 (-1,-1,-1);
    118120                if (index>-1){
    119121                RaceCheckPoint* tmp= this->getCheckpoint(index);
    120                 Vector3 v= tmp->getNextcheckpoint();
     122                v= tmp->getNextcheckpoint();
    121123       
    122        // orxout()<<"index not -1"<<endl;
     124       
    123125        if (this->getCheckpoint(v.x)==check){
    124126                b=true;
     
    137139            gametype->clock_.capture();
    138140            float time = gametype->clock_.getSecondsPrecise();
    139             if (check->bTimeLimit_!=0 && time > check->bTimeLimit_)
     141            if (check->getTimeLimit()!=0 && time > check->getTimeLimit())
    140142            {
    141143                gametype->timeIsUp();
     
    146148            else
    147149            {
     150                if (index > -1)this->setRadVis(player,false);
    148151                gametype->newCheckpointReached(check,player);
    149152                check->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
     153               
     154               
     155               
     156                this->setRadVis(player, true);
     157               
    150158            }
    151159        }
     
    153161    }
    154162   
     163    void SpaceRaceManager::setRadVis(PlayerInfo* player, bool b){
     164        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
     165        assert(gametype);
     166        int index=gametype->getCheckpointReached(player);
     167        Vector3 v=Vector3(-1,-1,-1);
     168        RaceCheckPoint* tmp= this->getCheckpoint(index);
     169                v= tmp->getNextcheckpoint();
    155170   
    156171   
    157     void SpaceRaceManager::setNext(RaceCheckPoint* check){
    158        
    159         Vector3 v=check->getNextcheckpoint();
    160                 check->setNext(0,this->getCheckpoint(v.x));
    161         check->setNext(1,this->getCheckpoint(v.y));
    162         check->setNext(2,this->getCheckpoint(v.z));
    163         }
     172         if(v.x > -1){this->getCheckpoint(v.x)->setRadarVisibility(b);
     173                this->getCheckpoint(v.x)->settingsChanged();}
     174                if(v.y > -1){this->getCheckpoint(v.y)->setRadarVisibility(b);
     175                this->getCheckpoint(v.y)->settingsChanged();}
     176                if(v.z > -1){this->getCheckpoint(v.z)->setRadarVisibility(b);
     177                this->getCheckpoint(v.z)->settingsChanged();}
     178   
     179    }
     180   
     181   
    164182   
    165183   
Note: See TracChangeset for help on using the changeset viewer.