Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 15, 2012, 11:51:58 PM (13 years ago)
Author:
jo
Message:

Merging presentation2011 branch to trunk. Please check for possible bugs.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/gametypes/RaceCheckPoint.cc

    r8858 r9016  
    3434#include "chat/ChatManager.h"
    3535
     36#include <infos/PlayerInfo.h>
     37#include <worldentities/ControllableEntity.h>
     38
    3639#include "SpaceRace.h"
    3740
     
    3942{
    4043    CreateFactory(RaceCheckPoint);
     44   
     45     
    4146
    42     RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
     47    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
    4348    {
    4449        RegisterObject(RaceCheckPoint);
    45 
    46         this->bCheckpointIndex_ = 0;
    47         this->bIsLast_ = false;
     50        this->setDistance(100);
     51        this->setBeaconMode("off");
     52        this->setBroadcast(false);
     53        this->setSimultaneousTriggerers(100);
    4854        this->bTimeLimit_ = 0;
    4955
     
    5157        this->setRadarObjectShape(RadarViewable::Triangle);
    5258        this->setRadarVisibility(false);
     59        this->settingsChanged();
     60        this->reached_=NULL;
     61     
    5362    }
     63   
    5464
    55     RaceCheckPoint::~RaceCheckPoint()
    56     {
    57     }
     65   RaceCheckPoint::~RaceCheckPoint()
     66   {
     67   
     68   }
    5869
    5970    void RaceCheckPoint::tick(float dt)
     
    6374        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
    6475        assert(gametype);
    65         if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
    66             this->setRadarVisibility(true);
    67         else
    68             this->setRadarVisibility(false);
    6976    }
    7077
     
    7279    {
    7380        SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
    74 
     81        Vector3 v= Vector3(0,0,0);
    7582        XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
    7683        XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
    7784        XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
     85    XMLPortParamTemplate(RaceCheckPoint, "nextcheckpoints", setNextcheckpoint, getNextcheckpoint, xmlelement, mode,const Vector3&).defaultValues(v);
    7886    }
    7987
    80     void RaceCheckPoint::triggered(bool bIsTriggered)
     88    void RaceCheckPoint::fire(bool bIsTriggered,BaseObject* player)
    8189    {
    82         DistanceTrigger::triggered(bIsTriggered);
    83 
     90        DistanceMultiTrigger::fire((bool)bIsTriggered,player);
     91       
    8492        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
    85         if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
    86         {
    87             gametype->clock_.capture();
    88             float time = gametype->clock_.getSecondsPrecise();
    89             if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
    90             {
    91                 gametype->timeIsUp();
    92                 gametype->end();
    93             }
    94             else if (this->getLast())
    95                 gametype->end();
    96             else
    97             {
    98                 gametype->newCheckpointReached();
    99                 this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
    100             }
    101         }
     93        assert(gametype);
     94        ControllableEntity* entity = (ControllableEntity*) player;
     95     
     96        PlayerInfo* player2 = entity->getPlayer();
     97     
     98        if(bIsTriggered)
     99            this->reached_=player2;
    102100    }
    103101
     
    108106        {
    109107            SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
     108            assert(gametype);
    110109            if (gametype)
    111110            {
Note: See TracChangeset for help on using the changeset viewer.