Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10385 in orxonox.OLD for trunk/src/util


Ignore:
Timestamp:
Jan 26, 2007, 6:06:04 PM (18 years ago)
Author:
bknecht
Message:

you're now able to set the track's mode

Location:
trunk/src/util/track
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/track/track.cc

    r10368 r10385  
    9191           LoadParam_CYCLE(element, "speed", this, Track, setSpeed)
    9292             .describe("Sets speed of traveling");
     93           LoadParam_CYCLE(element, "mode", this, Track, setMode)
     94             .describe("Sets mode of track behavior");
    9395
    9496     }
     
    132134     this->duration = this->duration/speed;
    133135     
     136}
     137
     138/**
     139 * Sets the mode of the track. 0 means wait at the end. 1 means rerun track
     140 */
     141void Track::setMode(int newMode)
     142{
     143     this->mode = newMode;
    134144}
    135145
     
    197207//     this->jumpTo(this->localTime);
    198208//   if (this->localTime <= this->maxTime)
    199      this->localTime += dt;
    200      if(this->localTime >= this->duration)
    201        this->localTime = 0;
     209     if(this->mode == 0)
     210     {
     211          if(this->localTime >= this->duration)
     212             this->localTime += dt;
     213     }
     214     else
     215     {
     216         this->localTime += dt;
     217         if(this->localTime >= this->duration)
     218            this->localTime = 0;
     219     }
     220     
    202221//   if (this->localTime > this->currentTrackElem->endTime
    203222//       && this->currentTrackElem->children)
  • trunk/src/util/track/track.h

    r10368 r10385  
    2626   void addPointV(Vector newPoint);
    2727   void setSpeed(float speed);
     28   void setMode(int newMode);
    2829
    2930   //void finalize();
     
    5253   float                localTime;              //!< The time that has been passed since the traveling the Track.
    5354   PNode*               trackNode;              //!< The node that is slave to the Track. This node will be moved while update the Track, and must NOT move itself.
     55   int                  mode;                   //!< Defines the behaviour of the Track.
    5456};
    5557
Note: See TracChangeset for help on using the changeset viewer.