[Orxonox-commit 6606] r11246 - in code/branches/SpaceRace_HS16: data/levels src/modules/gametypes src/orxonox/controllers src/orxonox/sound
bberabi at orxonox.net
bberabi at orxonox.net
Mon Oct 24 16:06:00 CEST 2016
Author: bberabi
Date: 2016-10-24 16:06:00 +0200 (Mon, 24 Oct 2016)
New Revision: 11246
Modified:
code/branches/SpaceRace_HS16/data/levels/Spacerace2.oxw
code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw
code/branches/SpaceRace_HS16/data/levels/spaceRace.oxw
code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc
code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceController.cc
code/branches/SpaceRace_HS16/src/orxonox/controllers/HumanController.h
code/branches/SpaceRace_HS16/src/orxonox/sound/WorldAmbientSound.cc
Log:
sound and countdown erledigt, flugzeuge konnen nicht mehr sich bewegen bevor countdown ends
Modified: code/branches/SpaceRace_HS16/data/levels/Spacerace2.oxw
===================================================================
--- code/branches/SpaceRace_HS16/data/levels/Spacerace2.oxw 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/data/levels/Spacerace2.oxw 2016-10-24 14:06:00 UTC (rev 11246)
@@ -23,8 +23,8 @@
<Level
name = "Spacerace2"
description = "Just a few tests"
- plugins = gametypes
- gametype = SpaceRace
+ plugins = "gametypes"
+ gametype = "SpaceRace"
>
<templates>
<Template link=lodtemplate_default />
Modified: code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw
===================================================================
--- code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw 2016-10-24 14:06:00 UTC (rev 11246)
@@ -31,15 +31,9 @@
>
<!-- SOUNDS & MUSIC -->
- <!-- <WorldSound name="scoreSound" position="0,-2100,0" source="sounds/ReadyGo.ogg" >
- <events>
- <play>
- <EventListener event="start" />
- </play>
- </events>
- </WorldSound> -->
-<WorldSound name="Countdown" position="0,-2100,0" source="sounds/Countdown.ogg" >
+
+<WorldSound name="Countdown" position="0,0,0" source="sounds/Countdown.ogg" >
<events>
<play>
<EventListener event="start1" />
@@ -48,7 +42,7 @@
</WorldSound>
-<WorldSound name="Go" position="0,-2100,0" source="sounds/Go.ogg" >
+<WorldSound name="Go" position="0,0,0" source="sounds/Go.ogg" >
<events>
<play>
<EventListener event="go" />
@@ -56,23 +50,30 @@
</events>
</WorldSound>
-<WorldSound name="racetheme" position="0,-2100,0" source="sounds/racetheme.ogg" >
- <events>
+
+ <DistanceTrigger name="start1" position="0,0,0" target="Pawn" distance=100 stayActive="true" delay=0.5 />
+ <DistanceTrigger name="go" position="0,0,0" target="Pawn" distance=100 stayActive="true" delay=10.5 />
+
+ <DistanceTrigger name="racetheme" position="0,0,0" target="Pawn" distance=100 stayActive="true" delay=10.75 />
+
+
+
+
+ <WorldAmbientSound source="racetheme.ogg" looping="true" playOnLoad="false" >
+ <events>
<play>
<EventListener event="racetheme" />
</play>
</events>
- </WorldSound>
+ </WorldAmbientSound>
- <DistanceTrigger name="start1" position="0,-2100,0" target="Pawn" distance=100 stayActive="true" delay=0.5 />
- <DistanceTrigger name="go" position="0,-2100,0" target="Pawn" distance=100 stayActive="true" delay=10.5 />
- <DistanceTrigger name="racetheme" position="0,-2100,0" target="Pawn" distance=100 stayActive="true" delay=10.7 />
- <WorldAmbientSound source="racetheme.ogg" looping="true" playOnLoad="true" />
+
+
<!-- <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" /> -->
Modified: code/branches/SpaceRace_HS16/data/levels/spaceRace.oxw
===================================================================
--- code/branches/SpaceRace_HS16/data/levels/spaceRace.oxw 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/data/levels/spaceRace.oxw 2016-10-24 14:06:00 UTC (rev 11246)
@@ -52,7 +52,6 @@
<DistanceTrigger name="start" position="0,-2100,0" target="Pawn" distance=100 stayActive="true" delay=0.5 />
- <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" />
<?lua math.randomseed(98) ?>
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc 2016-10-24 14:06:00 UTC (rev 11246)
@@ -32,7 +32,12 @@
#include "chat/ChatManager.h"
#include "util/Convert.h"
#include "util/Math.h"
+#include "SpaceRaceBot.h"
+#include "items/Engine.h"
+#include "controllers/HumanController.h"
+
+
namespace orxonox
{
RegisterUnloadableClass(OldSpaceRace);
@@ -42,7 +47,7 @@
RegisterObject(OldSpaceRace);
this->checkpointsReached_ = 0;
this->bTimeIsUp_ = false;
- this->numberOfBots_ = 0;
+ this->numberOfBots_ = 1;
}
void OldSpaceRace::end()
@@ -83,11 +88,44 @@
{
Gametype::start();
- std::string message("Take Them All!");
+ if (true)
+ {
+ this->spawnPlayersIfRequested();
+ this->cantMove_ = true;
+
+ for (Engine* engine : ObjectList<Engine>()){
+ engine->setActive(false);
+
+
+ }
+
+ }
+
+
+
+ std::string message("BE FAST BE FIRST");
this->getGametypeInfo()->sendAnnounceMessage(message);
ChatManager::message(message);
+
+Timer* countdownTimer = new Timer();
+ countdownTimer->setTimer(11, false, createExecutor(createFunctor(&OldSpaceRace::countdownFinished, this)));
}
+ void OldSpaceRace::countdownFinished()
+ {
+
+ std::string message("RACE STARTED ");
+ this->getGametypeInfo()->sendAnnounceMessage(message);
+ ChatManager::message(message);
+
+
+ for (Engine* engine : ObjectList<Engine>())
+ engine->setActive(true);
+
+
+
+ }
+
void OldSpaceRace::newCheckpointReached()
{
this->checkpointsReached_++;
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h 2016-10-24 14:06:00 UTC (rev 11246)
@@ -55,11 +55,14 @@
virtual ~OldSpaceRace() {}
virtual void start() override;
+
virtual void end() override;
+
virtual void newCheckpointReached();
virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command.
- //<! This is only a temporary solution. Better: create racingBots.
+ virtual void countdownFinished();
+ //<! This is only a temporary solution. Better: create racingBots.
inline void setCheckpointsReached(int n)
{ this->checkpointsReached_ = n;}
@@ -71,6 +74,7 @@
protected:
private:
+ bool cantMove_; ///< Helper variable, used to stall the engines before the race starts.
int checkpointsReached_; //The current number of check points reached by the player.
std::set<float> scores_; //The times of the players are saved in a set.
bool bTimeIsUp_; //True if one of the check points is reached too late.
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc 2016-10-24 14:06:00 UTC (rev 11246)
@@ -48,10 +48,16 @@
this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
this->cantMove_ = false;
this->bTimeIsUp_ = false;
- this->numberOfBots_ = 0; // quick fix: don't allow default-bots to enter the race
+ this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
// remove this line, if a raceBot has been created.
}
+
+
+
+
+
+
void SpaceRace::end()
{
this->clock_.capture();
@@ -77,6 +83,11 @@
this->Gametype::end();
}
+
+
+
+
+
void SpaceRace::tick(float dt)
{
SUPER(SpaceRace,tick,dt);
@@ -99,12 +110,19 @@
this->cantMove_= false;
- std::string message = "The race begins! Reach the check points as quickly as possible!";
+
+
+ std::string message = "Hello!";
this->getGametypeInfo()->sendAnnounceMessage(message);
ChatManager::message(message);
}
}
+
+
+
+
+
void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
{
this->checkpointReached_[player] = checkpoint;
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h 2016-10-24 14:06:00 UTC (rev 11246)
@@ -56,6 +56,7 @@
SpaceRace(Context* context);
virtual ~SpaceRace() {}
+
virtual void tick(float dt) override;
virtual void end() override;
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceController.cc 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceController.cc 2016-10-24 14:06:00 UTC (rev 11246)
@@ -15,7 +15,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
Modified: code/branches/SpaceRace_HS16/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/SpaceRace_HS16/src/orxonox/controllers/HumanController.h 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/orxonox/controllers/HumanController.h 2016-10-24 14:06:00 UTC (rev 11246)
@@ -92,9 +92,9 @@
static Pawn* getLocalControllerEntityAsPawn();
//friend class, for mouselook
friend class Map;
+ static HumanController* localController_s;
protected:
- static HumanController* localController_s;
bool controlPaused_;
}; // tolua_export
Modified: code/branches/SpaceRace_HS16/src/orxonox/sound/WorldAmbientSound.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/orxonox/sound/WorldAmbientSound.cc 2016-10-24 14:04:51 UTC (rev 11245)
+++ code/branches/SpaceRace_HS16/src/orxonox/sound/WorldAmbientSound.cc 2016-10-24 14:06:00 UTC (rev 11246)
@@ -57,7 +57,9 @@
soundList_.emplace_back("Asteroid_rocks.ogg");
soundList_.emplace_back("Ganymede.ogg");
soundList_.emplace_back("luke_grey_-_hypermode.ogg");
+ soundList_.emplace_back("racetheme.ogg");
+
}
WorldAmbientSound::~WorldAmbientSound()
{
More information about the Orxonox-commit
mailing list