[Orxonox-commit 7525] r12131 - in code/branches/WorldMap_HS18: data/levels data/overlays src/orxonox/controllers
linggj at orxonox.net
linggj at orxonox.net
Thu Nov 29 09:12:53 CET 2018
Author: linggj
Date: 2018-11-29 09:12:53 +0100 (Thu, 29 Nov 2018)
New Revision: 12131
Modified:
code/branches/WorldMap_HS18/data/levels/StoryModeMap.oxw
code/branches/WorldMap_HS18/data/overlays/StoryModeHUD.oxo
code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.cc
code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.cc
code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.h
Log:
it works but needs some beuty to be added
Modified: code/branches/WorldMap_HS18/data/levels/StoryModeMap.oxw
===================================================================
--- code/branches/WorldMap_HS18/data/levels/StoryModeMap.oxw 2018-11-28 22:17:41 UTC (rev 12130)
+++ code/branches/WorldMap_HS18/data/levels/StoryModeMap.oxw 2018-11-29 08:12:53 UTC (rev 12131)
@@ -15,7 +15,7 @@
?>
<Level
-gametype = StoryMode
+gametype = Deathmatch
>
<templates>
@@ -30,12 +30,12 @@
ambientlight = "0.2, 0.2, 0.2"
skybox = "Orxonox/Starbox"
>
- <StoryModeController position="0,0,0" collisionType="dynamic">
+ <StoryModeController position="0,0,0" collisionType="dynamic" mass=42000000 >
<attached>
- <Model position="550,300,0" mesh="assff.mesh" scale=20 visible="true" />
+ <Model position="0,0,0" mesh="assff.mesh" scale=20 visible="true" />
</attached>
-
+ <CameraPosition position="0,0,1000" direction="0, -1, 0" drag=false />
<collisionShapes>
<BoxCollisionShape position="0,0,0" halfExtents="3,1,10" />
</collisionShapes>
@@ -49,17 +49,24 @@
</attached>
</MovableEntity> -->
+
+
+
<StaticEntity position="0,0,0" direction="0,0,-1" >
<attached>
+ <Model name="a" position="550,300,0" mesh="planets/moon.mesh" scale=100 visible="true" />
+ <Billboard colour="1,0,0.05" position="550,300,-80" material="Flares/lensflare" scale=4.5 />
+
<Model name="a" position="600,370,0" mesh="planets/moon.mesh" scale=100 visible="false" />
<Model position="550,300,0" mesh="assff.mesh" scale=20 visible="false" orientation="-0.015,0.091,0.038,-0.995"/>
+
<Billboard colour="1,1,0.05" position="600,370,-80" material="Flares/lensflare" scale=4.5 />
- <Model position="100,350,-250" mesh="planets/moon.mesh" scale=100 visible="false"/>
+ <Model position="100,350,-250" mesh="planets/moon.mesh" scale=100 visible="true"/>
<Model position="50,300,-250" mesh="assff.mesh" scale=20 visible="false" orientation="-0.015,0.091,0.038,-0.995"/>
<Billboard colour="1,1,0.05" position="100,350,-330" material="Flares/lensflare" scale=4.5 />
@@ -91,7 +98,7 @@
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <SpawnPoint position="000.000, 000.000, 1000.000" orientation="0, 0, 0, -1" pawndesign=StoryMode />
+ <SpawnPoint position="000.000, 000.000, 1000.000" orientation="0, 0, 0, -1" spawnclass=StoryModeController pawndesign=StoryMode />
</Scene>
Modified: code/branches/WorldMap_HS18/data/overlays/StoryModeHUD.oxo
===================================================================
--- code/branches/WorldMap_HS18/data/overlays/StoryModeHUD.oxo 2018-11-28 22:17:41 UTC (rev 12130)
+++ code/branches/WorldMap_HS18/data/overlays/StoryModeHUD.oxo 2018-11-29 08:12:53 UTC (rev 12131)
@@ -10,3 +10,7 @@
</OverlayGroup>
</Template>
+ <Template name="spectatorhud">
+ <OverlayGroup name = "spectatorhud" scale = "1, 1">
+ </OverlayGroup>
+</Template>
Modified: code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.cc
===================================================================
--- code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.cc 2018-11-28 22:17:41 UTC (rev 12130)
+++ code/branches/WorldMap_HS18/src/orxonox/controllers/SMCoord.cc 2018-11-29 08:12:53 UTC (rev 12131)
@@ -55,7 +55,7 @@
break;
case 6:
coord.x= 0;
- coord.y = 900;
+ coord.y = -900;
coord.z = -1500;
break;
case 7:
Modified: code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.cc
===================================================================
--- code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.cc 2018-11-28 22:17:41 UTC (rev 12130)
+++ code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.cc 2018-11-29 08:12:53 UTC (rev 12131)
@@ -28,11 +28,13 @@
#include "StoryModeController.h"
+
#include "core/CoreIncludes.h"
#include "worldentities/ControllableEntity.h"
#include "graphics/Camera.h"
#include "SMCoord.h"
#include "core/XMLPort.h"
+#include "gamestates/GSLevel.h"
namespace orxonox
{
RegisterClass(StoryModeController);
@@ -45,7 +47,7 @@
moveForward_= false;
moveBackward_=false;
boostPressed_=false;
-
+ dtime_=50;
}
@@ -55,7 +57,7 @@
selectedPos_ = nullptr;
}
-
+ //void StoryModeController:: switchCamera(){};
void StoryModeController::updatePosition(){
Vector3 pos = selectedPos_->get3dcoordinate();
setPosition(pos);
@@ -66,60 +68,121 @@
void StoryModeController::tick(float dt)
{
- orxout(internal_error) << "Hi" << endl;
+ //orxout(internal_error) << "Hi" << endl;
SUPER(StoryModeController, tick, dt);
time_ +=dt;
+ Camera* camera = this->getCamera();
+
+
- if(moveForward_ == true){
- moveForward_ = false;
- selectedPos_->set(selectedPos_->getIndex()+1);
- updatePosition();
- }
- if(moveBackward_ == true){
- moveBackward_ = false;
- selectedPos_->set(selectedPos_->getIndex()-1);
+ if(time_>= dtime_*dt){
+
+ time_=0;
+
+ if(moveForward_ == true){
+ orxout(internal_error) << "Position update" << endl;
+ moveForward_ = false;
+ selectedPos_->set(selectedPos_->getIndex()+1);
updatePosition();
- }
- if(boostPressed_ == true){
- boostPressed_ = false;
- chooseGame();
- }
+ }
+
+ if(moveBackward_ == true){
+ orxout(internal_error) << "Position update" << endl;
+ moveBackward_ = false;
+ selectedPos_->set(selectedPos_->getIndex()-1);
+ updatePosition();
+ }
+
+ if(boostPressed_ == true){
+ boostPressed_ = false;
+ chooseGame();
+ }
+
+
+ if (camera != nullptr)
+ {
+
+ Vector3 epos = selectedPos_->get3dcoordinate();
+ orxout(internal_error) << "ex: "<< epos.x <<" ey: "<< epos.y << " ez: " << epos.z<< endl;
+ camera->setPosition(-(epos.x),-(epos.y),-(epos.z)+1000);
+ camera->setOrientation(Vector3::UNIT_Z, Degree(0));
+
+ }
+ }
-
}
void StoryModeController::moveFrontBack(const Vector2& value)
{
- orxout(internal_error) << "moveFrontBack" << endl;
+ // orxout(internal_error) << "moveFrontBack" << endl;
}
void StoryModeController::chooseGame()
{
- //findLevel(selectedPos_->getIndex());
+ int ind = selectedPos_->getIndex();
+ std::string name = "changeGame ";
+ switch(ind){
+ case 0:
+ name = name + "pong.oxw";
+ break;
+ case 1:
+
+ break;
+ case 2:
+
+ break;
+ case 3:
+
+ break;
+ case 4:
+
+ break;
+ case 5:
+
+ break;
+ case 6:
+
+ break;
+ case 7:
+
+ break;
+ case 8:
+
+ break;
+ default:
+ break;
+ }
+ CommandExecutor::execute(name);
+ /*for (GSLevel* level : ObjectList<GSLevel>())
+ level->changeGame(name);*/
+ //hideAllMenuSheets();
}
void StoryModeController::moveRightLeft(const Vector2& value)
{
- orxout(internal_error) << "RightLeft" << endl;
- if (value.x>0){
- moveForward_ =false;
- moveBackward_ =true;
- } else {
- moveBackward_ = false;
- moveForward_ = true;
+ if(!moveForward_&&!moveBackward_){
+ if (value.x>0){
+ orxout(internal_error) << "Right" << endl;
+ moveForward_ =true;
+ moveBackward_ =false;
+ } else {
+ orxout(internal_error) << "Left" << endl;
+ moveBackward_ = true;
+ moveForward_ = false;
+ }
}
}
void StoryModeController::rotateYaw(const Vector2& value){
- orxout(internal_error) << "RightLeft" << endl;
+ //orxout(internal_error) << "RightLeft" << endl;
}
void StoryModeController::rotatePitch(const Vector2& value){
- orxout(internal_error) << "RightLeft" << endl;
+ //orxout(internal_error) << "RightLeft" << endl;
}
void StoryModeController::rotateRoll(const Vector2& value){
- orxout(internal_error) << "RightLeft" << endl;
+ //orxout(internal_error) << "RightLeft" << endl;
}
void StoryModeController::fire(unsigned int a){}
void StoryModeController::fired(unsigned int b){}
Modified: code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.h
===================================================================
--- code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.h 2018-11-28 22:17:41 UTC (rev 12130)
+++ code/branches/WorldMap_HS18/src/orxonox/controllers/StoryModeController.h 2018-11-29 08:12:53 UTC (rev 12131)
@@ -30,7 +30,10 @@
#define _StoryModeController_H__
#include "OrxonoxPrereqs.h"
-
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/XMLPort.h"
#include <vector>
#include "tools/interfaces/Tickable.h"
#include "worldentities/ControllableEntity.h"
@@ -37,6 +40,14 @@
#include "worldentities/pawns/SpaceShip.h"
#include "SMCoord.h"
+//#include <gtest/gtest.h>
+#include "core/class/Identifier.h"
+#include "core/class/IdentifierManager.h"
+#include "core/command/ConsoleCommandIncludes.h"
+#include "core/command/CommandExecutor.h"
+#include "core/object/Destroyable.h"
+#include "core/module/ModuleInstance.h"
+
namespace orxonox
{
class _OrxonoxExport StoryModeController : public SpaceShip
@@ -54,6 +65,8 @@
void fire(unsigned int firemode);
virtual void fired(unsigned int firemode) override;
virtual void boost(bool bBoost) override;
+ //virtual void switchCamera() override;
+
virtual void setLocation(int index);
bool moveRight_ ;
bool moveLeft_ ;
@@ -61,6 +74,7 @@
private:
virtual void updatePosition();
float time_;
+ int dtime_;
bool moveForward_;
bool moveBackward_;
bool boostPressed_;
More information about the Orxonox-commit
mailing list