Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 27, 2009, 5:15:04 PM (15 years ago)
Author:
Aurelian
Message:

Checkpoints in a row working with final destination→ end of game

File:
1 edited

Legend:

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

    r2905 r2936  
    2929#include "OrxonoxStableHeaders.h"
    3030#include "CheckPoint.h"
     31#include "objects/gametypes/Asteroids.h"
    3132
    3233#include <OgreNode.h>
     
    4546    RegisterObject(CheckPoint);
    4647
    47     isForPlayer_ = true;
    48     bStayActive_ = true;
     48    this->setStayActive(true);
     49    this->setDistance(20);
     50    bIsDestination_ = false;
     51    this->setVisible(true);
    4952  }
    5053
     
    5255  {
    5356  }
     57 
     58  void CheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     59  {
     60    SUPER(CheckPoint, XMLPort, xmlelement, mode);
    5461
    55   void Checkpoint::triggered(bool bIsTriggered)
     62    XMLPortParam(CheckPoint, "isdestination", setDestination, getDestination, xmlelement, mode).defaultValues(false);
     63  }
     64 
     65  void CheckPoint::setDestination(bool isDestination)
     66  {
     67    bIsDestination_ = isDestination;
     68  }
     69
     70  bool CheckPoint::getDestination()
     71  {
     72    return bIsDestination_;
     73  }
     74
     75
     76  void CheckPoint::triggered(bool bIsTriggered)
    5677  {
    5778    DistanceTrigger::triggered(bIsTriggered);
    5879
    59     if (bIsTriggered)
     80    if (bIsTriggered && bIsDestination_)
    6081    {
    61       //...
     82      Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype());
     83      if (gametype)
     84      {
     85        gametype->end();
     86      }
    6287    }
    6388  }
Note: See TracChangeset for help on using the changeset viewer.