Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8954 for code


Ignore:
Timestamp:
Nov 30, 2011, 4:17:00 PM (13 years ago)
Author:
eceline
Message:

DistanceMultiTrigger

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

Legend:

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

    r8949 r8954  
    4040    CreateFactory(RaceCheckPoint);
    4141   
    42       
     42     
    4343
    44     RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
     44    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
    4545    {
    4646        RegisterObject(RaceCheckPoint);
    47        
     47        this->setDistance(100);
     48        this->setBeaconMode("off");
     49        this->setBroadcast(false);
     50        this->setSimultaneousTriggerers(100);
    4851       
    4952           
     
    5659        this->setRadarObjectShape(RadarViewable::Triangle);
    5760        this->setRadarVisibility(true);
     61   
     62    //this->addTarget("WorldEntity");
     63   
     64   
    5865    }
     66   
    5967
    60     RaceCheckPoint::~RaceCheckPoint()
     68   RaceCheckPoint::~RaceCheckPoint()
    6169    {
    62          //if (this->isInitialized())
     70   
     71         if (this->isInitialized())
    6372        {
    6473            //for (size_t i = 0; i < 3; ++i)
     
    7685        if(this->isVisible_){this->setRadarVisibility(true);}
    7786        else{this->setRadarVisibility(false);}
    78        
     87       
     88     
     89     
    7990       
    8091        /*this->setRadarVisibility(false);
     
    103114    }
    104115
    105         void RaceCheckPoint::triggered(bool bIsTriggered, PlayerInfo* player)
     116        void RaceCheckPoint::fire(bool bIsTriggered,BaseObject* player)
    106117    {
    107         DistanceTrigger::triggered(bIsTriggered);
     118       
     119        //bool b= bIsTriggered;
     120        //PlayerInfo* pl= player;
     121        DistanceMultiTrigger::fire((bool)bIsTriggered,player);
     122       
     123   //SUPER(RaceCheckPoint,fire,bIsTriggered,player);
     124               
    108125
    109126        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
    110127        assert(gametype);
    111         if (gametype && this->getCheckpointIndex() == gametype->getCheckpointReached(player) && bIsTriggered)
     128       
     129                 PlayerInfo* player2 = (PlayerInfo*)player;
     130        assert(player2);
     131                //DistanceMultiTrigger::fire(bIsTriggered,player);
     132               
     133               
     134               
     135       
     136               
     137        if (gametype && this->getCheckpointIndex() == gametype->getCheckpointReached(player2) && bIsTriggered)
    112138        {
    113139            gametype->clock_.capture();
     
    122148            else
    123149            {
    124                 gametype->newCheckpointReached(this,player);
     150                gametype->newCheckpointReached(this,player2);
    125151                this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
    126152            }
  • code/branches/spaceraceTwo/src/modules/gametypes/RaceCheckPoint.h

    r8940 r8954  
    3232#include "gametypes/GametypesPrereqs.h"
    3333
    34 #include "objects/triggers/DistanceTrigger.h"
     34#include "objects/triggers/DistanceMultiTrigger.h"
    3535#include "interfaces/RadarViewable.h"
    3636
     
    4242        !!! Don't forget to control the indexes of your check points and to set one last check point!!!
    4343    */
    44     class _GametypesExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
     44    class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable
    4545    {
    4646        public:
     
    6565                {this->isVisible_ = b;}
    6666        protected:
    67             virtual void triggered(bool bIsTriggered, PlayerInfo* player);
     67            virtual void fire(bool bIsTriggered,BaseObject* player);
    6868            inline void setLast(bool isLast)
    6969                { this->bIsLast_ = isLast; }
  • code/branches/spaceraceTwo/src/modules/gametypes/SpaceRace.cc

    r8949 r8954  
    117117                               
    118118                               this->addBots(this->numberOfBots_);
     119                               
    119120     
    120121    }
  • code/branches/spaceraceTwo/src/modules/objects/triggers/DistanceMultiTrigger.h

    r8706 r8954  
    9191    @ingroup MultiTrigger
    9292    */
    93     class _ObjectsExport DistanceMultiTrigger : public MultiTrigger
     93    class _ObjectsExport DistanceMultiTrigger : public MultiTrigger 
    9494    {
    9595
  • code/branches/spaceraceTwo/src/modules/objects/triggers/MultiTrigger.h

    r8457 r8954  
    157157            bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.
    158158
    159             void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
     159            virtual void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
    160160            void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target.
    161161
Note: See TracChangeset for help on using the changeset viewer.