[Orxonox-commit 303] r2936 - in branches/gametypes/src/orxonox/objects: gametypes worldentities/triggers
Aurelian at orxonox.net
Aurelian at orxonox.net
Mon Apr 27 17:15:04 CEST 2009
Author: Aurelian
Date: 2009-04-27 17:15:04 +0200 (Mon, 27 Apr 2009)
New Revision: 2936
Modified:
branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt
branches/gametypes/src/orxonox/objects/worldentities/triggers/CMakeLists.txt
branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h
branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h
Log:
Checkpoints in a row working with final destination-> end of game
Modified: branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc 2009-04-27 15:12:59 UTC (rev 2935)
+++ branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc 2009-04-27 15:15:04 UTC (rev 2936)
@@ -53,7 +53,7 @@
Host::Broadcast(message);
}
- void Deathmatch::end()
+ void Asteroids::end()
{
Gametype::end();
Modified: branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt 2009-04-27 15:12:59 UTC (rev 2935)
+++ branches/gametypes/src/orxonox/objects/gametypes/CMakeLists.txt 2009-04-27 15:15:04 UTC (rev 2936)
@@ -5,4 +5,5 @@
TeamBaseMatch.cc
Pong.cc
UnderAttack.cc
+ Asteroids.cc
)
Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/CMakeLists.txt
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/CMakeLists.txt 2009-04-27 15:12:59 UTC (rev 2935)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/CMakeLists.txt 2009-04-27 15:15:04 UTC (rev 2936)
@@ -3,4 +3,5 @@
DistanceTrigger.cc
EventTrigger.cc
PlayerTrigger.cc
+ CheckPoint.cc
)
Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc 2009-04-27 15:12:59 UTC (rev 2935)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc 2009-04-27 15:15:04 UTC (rev 2936)
@@ -28,6 +28,7 @@
#include "OrxonoxStableHeaders.h"
#include "CheckPoint.h"
+#include "objects/gametypes/Asteroids.h"
#include <OgreNode.h>
@@ -44,21 +45,45 @@
{
RegisterObject(CheckPoint);
- isForPlayer_ = true;
- bStayActive_ = true;
+ this->setStayActive(true);
+ this->setDistance(20);
+ bIsDestination_ = false;
+ this->setVisible(true);
}
CheckPoint::~CheckPoint()
{
}
+
+ void CheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(CheckPoint, XMLPort, xmlelement, mode);
- void Checkpoint::triggered(bool bIsTriggered)
+ XMLPortParam(CheckPoint, "isdestination", setDestination, getDestination, xmlelement, mode).defaultValues(false);
+ }
+
+ void CheckPoint::setDestination(bool isDestination)
{
+ bIsDestination_ = isDestination;
+ }
+
+ bool CheckPoint::getDestination()
+ {
+ return bIsDestination_;
+ }
+
+
+ void CheckPoint::triggered(bool bIsTriggered)
+ {
DistanceTrigger::triggered(bIsTriggered);
- if (bIsTriggered)
+ if (bIsTriggered && bIsDestination_)
{
- //...
+ Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype());
+ if (gametype)
+ {
+ gametype->end();
+ }
}
}
}
Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h 2009-04-27 15:12:59 UTC (rev 2935)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h 2009-04-27 15:15:04 UTC (rev 2936)
@@ -35,27 +35,32 @@
#ifndef _CheckPoint_H__
#define _CheckPoint_H__
-#include "OrxonoxPrereqs.h"
+#include "DistanceTrigger.h"
-#include "Trigger.h"
+#include <set>
+#include "core/ClassTreeMask.h"
+#include "core/BaseObject.h"
+
+#include "orxonox/objects/worldentities/ControllableEntity.h"
+
namespace orxonox
{
- class _OrxonoxExport CheckPoint : public DistanceTrigger
+ class _OrxonoxExport CheckPoint : public DistanceTrigger
{
public:
- CheckPoint(BaseObject* creator);
- virtual ~CheckPoint();
+ CheckPoint(BaseObject* creator);
+ virtual ~CheckPoint();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
-
private:
- virtual void triggered(bool bIsTriggered);
-
- bool bIsDestination_;
- };
-
+ virtual void triggered(bool bIsTriggered);
+ virtual void setDestination(bool isDestination);
+ virtual bool getDestination();
+
+ bool bIsDestination_;
+ };
}
#endif /* _CheckPoint_H__ */
Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h 2009-04-27 15:12:59 UTC (rev 2935)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/Trigger.h 2009-04-27 15:15:04 UTC (rev 2936)
@@ -88,6 +88,9 @@
inline int getActivations() const
{ return this->remainingActivations_; }
+ inline void setVisible(bool visibility)
+ { this->debugBillboard_.setVisible(visibility); }
+
void setDelay(float delay);
inline float getDelay() const
{ return this->delay_; }
More information about the Orxonox-commit
mailing list