From 97c3097fc7177f3f883f3fce88e2325319f5c2b6 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Wed, 12 Feb 2014 13:37:21 +0100 Subject: [PATCH] GL - added jumppad model and rigidbody --- .../DanBiasGame/GameClientState/GameState.cpp | 15 ++++++++------- Code/Game/GameLogic/CollisionManager.cpp | 4 ++++ Code/Game/GameLogic/GameLogicStates.h | 1 + Code/Game/GameLogic/Level.cpp | 7 +++++++ Code/Game/GameLogic/Level.h | 1 + 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 4c2899e1..1fcac537 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -140,6 +140,13 @@ bool GameState::LoadModels() this->staticObjects.Push(new C_StaticObj()); this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData); + // add jumppad + modelData.position = Oyster::Math::Float3(4, 600.3, 0); + modelData.modelPath = L"jumppad_round.dan"; + modelData.id = id++; + // load models + this->staticObjects.Push(new C_StaticObj()); + this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData); // add player model modelData.position = Oyster::Math::Float3(0, 602, 0); @@ -157,13 +164,7 @@ bool GameState::LoadModels() this->dynamicObjects.Push(new C_DynamicObj()); this->dynamicObjects[this->dynamicObjects.Size() -1 ]->Init(modelData); - // add jumppad - modelData.position = Oyster::Math::Float3(4, 600.3, 0); - modelData.modelPath = L"jumppad_round.dan"; - modelData.id = id++; - // load models - this->dynamicObjects.Push(new C_DynamicObj()); - this->dynamicObjects[this->dynamicObjects.Size() -1 ]->Init(modelData); + // add sky sphere modelData.position = Oyster::Math::Float3(0,0,0); diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 0ef2a204..c4cea1b4 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -40,6 +40,10 @@ using namespace GameLogic; PlayerVObject(*player,*realObj, kineticEnergyLoss); //player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING; break; + case OBJECT_TYPE::OBJECT_TYPE_JUMPPAD: + int i = 0; + // JUMP + break; } //return Physics::ICustomBody::SubscriptMessage_none; diff --git a/Code/Game/GameLogic/GameLogicStates.h b/Code/Game/GameLogic/GameLogicStates.h index 00c2e7ff..94a58f04 100644 --- a/Code/Game/GameLogic/GameLogicStates.h +++ b/Code/Game/GameLogic/GameLogicStates.h @@ -27,6 +27,7 @@ namespace GameLogic OBJECT_TYPE_BOX = 1, OBJECT_TYPE_WORLD = 2, OBJECT_TYPE_GENERIC = 4, + OBJECT_TYPE_JUMPPAD = 8, OBJECT_TYPE_UNKNOWN = -1, }; diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 04324fcc..57b39c92 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -179,6 +179,13 @@ void Level::InitiateLevel(float radius) this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_GENERIC)); rigidBody_House->SetCustomTag(this->staticObjects[0]); this->staticObjects[0]->objectID = idCount++; + + // add jumppad + ICustomBody* rigidBody_Jumppad = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(4, 600.3, 0), 5, 0.5f, 0.8f, 0.6f); + + this->staticObjects.Push(new JumpPad(rigidBody_Jumppad, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_JUMPPAD, Oyster::Math::Float3(0,1,0))); + rigidBody_Jumppad->SetCustomTag(this->staticObjects[1]); + this->staticObjects[1]->objectID = idCount++; } void Level::AddPlayerToTeam(Player *player, int teamID) diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h index 15f4a832..b8c3f744 100644 --- a/Code/Game/GameLogic/Level.h +++ b/Code/Game/GameLogic/Level.h @@ -9,6 +9,7 @@ #include "StaticObject.h" #include "DynamicObject.h" #include "GameModeType.h" +#include "JumpPad.h" #include "Player.h" #include "PhysicsAPI.h" #include "TeamManager.h"