Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 11, 2009, 5:00:55 PM (15 years ago)
Author:
Aurelian
Message:

Added timer in class gametype, timer working in asteroids, modified checkpoint with firstCheckPoint… working! yeepa ;-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc

    r2936 r2970  
    4747
    4848    this->setStayActive(true);
    49     this->setDistance(20);
    50     bIsDestination_ = false;
     49    this->setDistance(50);
     50    this->bIsFirst_ = false;
     51    this->bIsDestination_ = false;
    5152    this->setVisible(true);
    5253  }
     
    6061    SUPER(CheckPoint, XMLPort, xmlelement, mode);
    6162
     63    XMLPortParam(CheckPoint, "isfirst", setFirst, getFirst, xmlelement, mode).defaultValues(false);
    6264    XMLPortParam(CheckPoint, "isdestination", setDestination, getDestination, xmlelement, mode).defaultValues(false);
     65    XMLPortParam(CheckPoint, "addtime", setAddTime, getAddTime, xmlelement, mode).defaultValues(30);
    6366  }
    6467 
    65   void CheckPoint::setDestination(bool isDestination)
    66   {
    67     bIsDestination_ = isDestination;
    68   }
    69 
    70   bool CheckPoint::getDestination()
    71   {
    72     return bIsDestination_;
    73   }
    74 
    75 
    7668  void CheckPoint::triggered(bool bIsTriggered)
    7769  {
    7870    DistanceTrigger::triggered(bIsTriggered);
    7971
    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     }
    8887  }
    8988}
Note: See TracChangeset for help on using the changeset viewer.