- Timestamp:
- May 11, 2009, 5:00:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
r2936 r2970 47 47 48 48 this->setStayActive(true); 49 this->setDistance(20); 50 bIsDestination_ = false; 49 this->setDistance(50); 50 this->bIsFirst_ = false; 51 this->bIsDestination_ = false; 51 52 this->setVisible(true); 52 53 } … … 60 61 SUPER(CheckPoint, XMLPort, xmlelement, mode); 61 62 63 XMLPortParam(CheckPoint, "isfirst", setFirst, getFirst, xmlelement, mode).defaultValues(false); 62 64 XMLPortParam(CheckPoint, "isdestination", setDestination, getDestination, xmlelement, mode).defaultValues(false); 65 XMLPortParam(CheckPoint, "addtime", setAddTime, getAddTime, xmlelement, mode).defaultValues(30); 63 66 } 64 67 65 void CheckPoint::setDestination(bool isDestination)66 {67 bIsDestination_ = isDestination;68 }69 70 bool CheckPoint::getDestination()71 {72 return bIsDestination_;73 }74 75 76 68 void CheckPoint::triggered(bool bIsTriggered) 77 69 { 78 70 DistanceTrigger::triggered(bIsTriggered); 79 71 80 if (bIsTriggered && bIsDestination_) 81 { 82 Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype()); 83 if (gametype) 84 { 85 gametype->end(); 86 } 87 } 72 Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype()); 73 if (gametype) 74 { 75 gametype->addTime(addTime_); 76 77 if (bIsTriggered && bIsFirst_) 78 { 79 gametype->firstCheckpointReached(true); 80 } 81 82 if (bIsTriggered && bIsDestination_) 83 { 84 gametype->end(); 85 } 86 } 88 87 } 89 88 }
Note: See TracChangeset
for help on using the changeset viewer.