Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2936


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

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

Location:
code/branches/gametypes/src/orxonox/objects
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc

    r2905 r2936  
    5454    }
    5555
    56     void Deathmatch::end()
     56    void Asteroids::end()
    5757    {
    5858        Gametype::end();
  • code/branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt

    r2934 r2936  
    66  Pong.cc
    77  UnderAttack.cc
     8  Asteroids.cc
    89)
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CMakeLists.txt

    r2710 r2936  
    44  EventTrigger.cc
    55  PlayerTrigger.cc
     6  CheckPoint.cc
    67)
  • 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  }
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h

    r2905 r2936  
    3636#define _CheckPoint_H__
    3737
    38 #include "OrxonoxPrereqs.h"
     38#include "DistanceTrigger.h"
    3939
    40 #include "Trigger.h"
     40#include <set>
     41
     42#include "core/ClassTreeMask.h"
     43#include "core/BaseObject.h"
     44
     45#include "orxonox/objects/worldentities/ControllableEntity.h"
    4146
    4247namespace orxonox
    4348{
    44     class _OrxonoxExport CheckPoint : public DistanceTrigger
     49  class _OrxonoxExport CheckPoint : public DistanceTrigger
    4550    {
    4651    public:
    47         CheckPoint(BaseObject* creator);
    48         virtual ~CheckPoint();
     52      CheckPoint(BaseObject* creator);
     53      virtual ~CheckPoint();
    4954       
    50         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
     55      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
    5156
    52        
    5357    private:
    54        virtual void triggered(bool bIsTriggered);
    55 
    56        bool bIsDestination_;   
    57     };
    58 
     58      virtual void triggered(bool bIsTriggered);
     59      virtual void setDestination(bool isDestination);
     60      virtual bool getDestination();   
     61     
     62      bool bIsDestination_;
     63  };
    5964}
    6065
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h

    r2905 r2936  
    8989        { return this->remainingActivations_; }
    9090
     91      inline void setVisible(bool visibility)
     92        { this->debugBillboard_.setVisible(visibility); }
     93
    9194      void setDelay(float delay);
    9295      inline float getDelay() const
Note: See TracChangeset for help on using the changeset viewer.