Gameserver - Merged with gamelogic
This commit is contained in:
commit
504f11ef4c
|
@ -90,9 +90,12 @@ int C_Object::GetId() const
|
||||||
void C_Object::Render()
|
void C_Object::Render()
|
||||||
{
|
{
|
||||||
if( this->model )
|
if( this->model )
|
||||||
|
{
|
||||||
|
if(this->model->Visible)
|
||||||
{
|
{
|
||||||
Oyster::Graphics::API::RenderModel(model);
|
Oyster::Graphics::API::RenderModel(model);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void C_Object::Release()
|
void C_Object::Release()
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,19 +158,28 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
|
||||||
|
|
||||||
GameClientState::ClientState GameState::Update( float deltaTime )
|
GameClientState::ClientState GameState::Update( float deltaTime )
|
||||||
{
|
{
|
||||||
GameStateUI::UIState UIstate = this->currGameUI->Update( deltaTime );
|
GameStateUI::UIState UIstate = this->gameUI->Update( deltaTime );
|
||||||
switch (UIstate)
|
switch (UIstate)
|
||||||
{
|
{
|
||||||
|
case DanBias::Client::GameStateUI::UIState_shut_down:
|
||||||
|
{
|
||||||
|
this->privData->nextState = ClientState_Quit;
|
||||||
|
// disconnect
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
case DanBias::Client::GameStateUI::UIState_same:
|
case DanBias::Client::GameStateUI::UIState_same:
|
||||||
break;
|
break;
|
||||||
case DanBias::Client::GameStateUI::UIState_gaming:
|
case DanBias::Client::GameStateUI::UIState_gaming:
|
||||||
break;
|
break;
|
||||||
case DanBias::Client::GameStateUI::UIState_main_menu:
|
case DanBias::Client::GameStateUI::UIState_main_menu:
|
||||||
//this->privData->nextState =
|
{
|
||||||
break;
|
this->privData->nextState = ClientState_Main;
|
||||||
case DanBias::Client::GameStateUI::UIState_shut_down:
|
// disconnect
|
||||||
this->privData->nextState = ClientState_Quit;
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -603,6 +612,12 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
{
|
{
|
||||||
// if it is not a player
|
// if it is not a player
|
||||||
object = (*this->privData->dynamicObjects)[decoded.objectID];
|
object = (*this->privData->dynamicObjects)[decoded.objectID];
|
||||||
|
|
||||||
|
if(!object)
|
||||||
|
{
|
||||||
|
//If it is a static object
|
||||||
|
object = (*this->privData->staticObjects)[decoded.objectID];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( object )
|
if( object )
|
||||||
|
@ -620,6 +635,12 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
{
|
{
|
||||||
// if it is not a player
|
// if it is not a player
|
||||||
object = (*this->privData->dynamicObjects)[decoded.objectID];
|
object = (*this->privData->dynamicObjects)[decoded.objectID];
|
||||||
|
|
||||||
|
if(!object)
|
||||||
|
{
|
||||||
|
//If it is a static object
|
||||||
|
object = (*this->privData->staticObjects)[decoded.objectID];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( object )
|
if( object )
|
||||||
|
@ -757,6 +778,15 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
case GameLogic::PlayerAction::PlayerAction_Idle:
|
case GameLogic::PlayerAction::PlayerAction_Idle:
|
||||||
player->playAnimation(L"idle", true);
|
player->playAnimation(L"idle", true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GameLogic::WeaponAction::WeaponAction_PrimaryShoot:
|
||||||
|
break;
|
||||||
|
case GameLogic::WeaponAction::WeaponAction_SecondaryShoot:
|
||||||
|
break;
|
||||||
|
case GameLogic::WeaponAction::WeaponAction_Reload:
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -764,6 +794,28 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GameClientState::event_processed;
|
return GameClientState::event_processed;
|
||||||
|
case protocol_Gameplay_ObjectCollision:
|
||||||
|
{
|
||||||
|
Protocol_ObjectCollision decoded(data);
|
||||||
|
C_Object *object;
|
||||||
|
object = (this->privData->players)[decoded.objectID];
|
||||||
|
if( !object)
|
||||||
|
{
|
||||||
|
// if it is not a player
|
||||||
|
object = (*this->privData->dynamicObjects)[decoded.objectID];
|
||||||
|
}
|
||||||
|
if( object )
|
||||||
|
{
|
||||||
|
switch (decoded.collisionID)
|
||||||
|
{
|
||||||
|
case GameLogic::CollisionEvent::CollisionEvent_BasicCollision:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GameClientState::event_processed;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ GamingUI::GamingUI() :
|
||||||
this->camera = nullptr;
|
this->camera = nullptr;
|
||||||
this->plane = nullptr;
|
this->plane = nullptr;
|
||||||
this->text = nullptr;
|
this->text = nullptr;
|
||||||
|
this->nextState = GameStateUI::UIState_same;
|
||||||
}
|
}
|
||||||
|
|
||||||
GamingUI::GamingUI( SharedStateContent* shared, Camera_FPSV2 *camera ) :
|
GamingUI::GamingUI( SharedStateContent* shared, Camera_FPSV2 *camera ) :
|
||||||
|
@ -24,6 +25,7 @@ GamingUI::GamingUI( SharedStateContent* shared, Camera_FPSV2 *camera ) :
|
||||||
{
|
{
|
||||||
this->sharedData = shared;
|
this->sharedData = shared;
|
||||||
this->camera = camera;
|
this->camera = camera;
|
||||||
|
this->nextState = GameStateUI::UIState_same;
|
||||||
}
|
}
|
||||||
|
|
||||||
GamingUI::~GamingUI() { /* Do nothing */ }
|
GamingUI::~GamingUI() { /* Do nothing */ }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "AttatchmentMassDriver.h"
|
#include "AttatchmentMassDriver.h"
|
||||||
#include "PhysicsAPI.h"
|
#include "PhysicsAPI.h"
|
||||||
#include "GameLogicStates.h"
|
#include "GameLogicStates.h"
|
||||||
|
#include "Game.h"
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
{
|
{
|
||||||
currentEnergy -= 90.0f;
|
currentEnergy -= 90.0f;
|
||||||
ForcePush(usage,dt);
|
ForcePush(usage,dt);
|
||||||
|
// add CD
|
||||||
|
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_PrimaryShoot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -56,6 +58,8 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
{
|
{
|
||||||
currentEnergy -= 1.0f;
|
currentEnergy -= 1.0f;
|
||||||
ForcePull(usage,dt);
|
ForcePull(usage,dt);
|
||||||
|
// add CD
|
||||||
|
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_SecondaryShoot);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -64,6 +68,8 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
{
|
{
|
||||||
currentEnergy -= 90.0f;
|
currentEnergy -= 90.0f;
|
||||||
ForceZip(usage,dt);
|
ForceZip(usage,dt);
|
||||||
|
// add CD
|
||||||
|
((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_UtilityActivate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ using namespace GameLogic;
|
||||||
realObjB = realObjA;
|
realObjB = realObjA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (realObjB->GetObjectType())
|
switch (realObjB->GetObjectType())
|
||||||
{
|
{
|
||||||
case ObjectSpecialType::ObjectSpecialType_Generic:
|
case ObjectSpecialType::ObjectSpecialType_Generic:
|
||||||
|
@ -69,7 +68,8 @@ using namespace GameLogic;
|
||||||
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// send collision event message
|
||||||
|
((Game*)&Game::Instance())->onCollisionEventFnc(player, CollisionEvent::CollisionEvent_BasicCollision);
|
||||||
//return Physics::ICustomBody::SubscriptMessage_none;
|
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,16 +255,18 @@ using namespace GameLogic;
|
||||||
{
|
{
|
||||||
//realobjA is the affectedObject, transfer this to realobjB
|
//realobjA is the affectedObject, transfer this to realobjB
|
||||||
realObjB->SetAffectedBy(*realObjA->getAffectingPlayer());
|
realObjB->SetAffectedBy(*realObjA->getAffectingPlayer());
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
if(realObjB->getAffectingPlayer() != NULL && realObjA->getAffectingPlayer() == NULL)
|
if(realObjB->getAffectingPlayer() != NULL && realObjA->getAffectingPlayer() == NULL)
|
||||||
{
|
{
|
||||||
//realobjB is the affectedObject, transfer this to realobjA
|
//realobjB is the affectedObject, transfer this to realobjA
|
||||||
realObjA->SetAffectedBy(*realObjB->getAffectingPlayer());
|
realObjA->SetAffectedBy(*realObjB->getAffectingPlayer());
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(realObjA->getAffectingPlayer() != NULL && realObjB->getAffectingPlayer() != NULL)
|
if(realObjA->getAffectingPlayer() != NULL && realObjB->getAffectingPlayer() != NULL && ( realObjA->getAffectingPlayer()->GetID() != realObjB->getAffectingPlayer()->GetID()))
|
||||||
{
|
{
|
||||||
//Both objects have a player affecting them, now use the special case
|
//Both objects have a player affecting them, now use the special case
|
||||||
if(realObjA->GetRigidBody()->GetState().previousVelocity.GetMagnitude() > realObjB->GetRigidBody()->GetState().previousVelocity.GetMagnitude() )
|
if(realObjA->GetRigidBody()->GetState().previousVelocity.GetMagnitude() > realObjB->GetRigidBody()->GetState().previousVelocity.GetMagnitude() )
|
||||||
|
@ -374,9 +376,14 @@ using namespace GameLogic;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(b->GetObjectType() == ObjectSpecialType_Player)
|
if(b->GetObjectType() == ObjectSpecialType_Player)
|
||||||
|
{
|
||||||
|
//Only update if it is active. And if the player is alive
|
||||||
|
if(((Pickup*)a)->IsActive() && ((Player*)b)->GetState() != PLAYER_STATE_DEAD && ((Player*)b)->GetState() != PLAYER_STATE_DIED)
|
||||||
{
|
{
|
||||||
((Pickup*)a)->OnCollision((Player*)(b));
|
((Pickup*)a)->OnCollision((Player*)(b));
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if(a->GetObjectType() != ObjectSpecialType_Player)
|
else if(a->GetObjectType() != ObjectSpecialType_Player)
|
||||||
{
|
{
|
||||||
//One of the objects are not a player.
|
//One of the objects are not a player.
|
||||||
|
@ -384,5 +391,9 @@ using namespace GameLogic;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Only update if it is active. And if the player is alive
|
||||||
|
if(((Pickup*)b)->IsActive() && ((Player*)a)->GetState() != PLAYER_STATE_DEAD && ((Player*)a)->GetState() != PLAYER_STATE_DIED)
|
||||||
|
{
|
||||||
((Pickup*)b)->OnCollision((Player*)a);
|
((Pickup*)b)->OnCollision((Player*)a);
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -90,11 +90,6 @@ void DynamicObject::Activate()
|
||||||
void DynamicObject::SetAffectedBy(Player &player)
|
void DynamicObject::SetAffectedBy(Player &player)
|
||||||
{
|
{
|
||||||
this->affectedBy = &player;
|
this->affectedBy = &player;
|
||||||
if(this->type != ObjectSpecialType::ObjectSpecialType_Player) //should not add itself to its own list if its a player
|
|
||||||
{
|
|
||||||
player.AddAffectedObject(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* DynamicObject::getAffectingPlayer()
|
Player* DynamicObject::getAffectingPlayer()
|
||||||
|
|
|
@ -182,12 +182,16 @@ void Game::SetDeadSubscription(GameEvent::ObjectDeadFunction functionPointer)
|
||||||
}
|
}
|
||||||
void Game::SetActionSubscription(GameEvent::AnimationEventFunction functionPointer)
|
void Game::SetActionSubscription(GameEvent::AnimationEventFunction functionPointer)
|
||||||
{
|
{
|
||||||
this->onPlayerActionEventFnc = functionPointer;
|
this->onActionEventFnc = functionPointer;
|
||||||
}
|
}
|
||||||
void Game::SetPickupSubscription(GameEvent::PickupEventFunction functionPointer)
|
void Game::SetPickupSubscription(GameEvent::PickupEventFunction functionPointer)
|
||||||
{
|
{
|
||||||
this->onPickupEventFnc = functionPointer;
|
this->onPickupEventFnc = functionPointer;
|
||||||
}
|
}
|
||||||
|
void Game::SetCollisionSubscription(GameEvent::CollisionEventFunction functionPointer)
|
||||||
|
{
|
||||||
|
this->onCollisionEventFnc = functionPointer;
|
||||||
|
}
|
||||||
bool Game::Initiate()
|
bool Game::Initiate()
|
||||||
{
|
{
|
||||||
API::Instance().Init();
|
API::Instance().Init();
|
||||||
|
|
|
@ -87,6 +87,7 @@ namespace GameLogic
|
||||||
void SetDeadSubscription(GameEvent::ObjectDeadFunction functionPointer) override;
|
void SetDeadSubscription(GameEvent::ObjectDeadFunction functionPointer) override;
|
||||||
void SetActionSubscription(GameEvent::AnimationEventFunction functionPointer) override;
|
void SetActionSubscription(GameEvent::AnimationEventFunction functionPointer) override;
|
||||||
void SetPickupSubscription(GameEvent::PickupEventFunction functionPointer) override;
|
void SetPickupSubscription(GameEvent::PickupEventFunction functionPointer) override;
|
||||||
|
void SetCollisionSubscription(GameEvent::CollisionEventFunction functionPointer) override;
|
||||||
bool Initiate() override;
|
bool Initiate() override;
|
||||||
|
|
||||||
float GetFrameTime() const;
|
float GetFrameTime() const;
|
||||||
|
@ -106,8 +107,9 @@ namespace GameLogic
|
||||||
GameEvent::ObjectHpFunction onDamageTakenFnc;
|
GameEvent::ObjectHpFunction onDamageTakenFnc;
|
||||||
GameEvent::ObjectRespawnedFunction onRespawnFnc;
|
GameEvent::ObjectRespawnedFunction onRespawnFnc;
|
||||||
GameEvent::ObjectDeadFunction onDeadFnc;
|
GameEvent::ObjectDeadFunction onDeadFnc;
|
||||||
GameEvent::AnimationEventFunction onPlayerActionEventFnc;
|
GameEvent::AnimationEventFunction onActionEventFnc;
|
||||||
GameEvent::PickupEventFunction onPickupEventFnc;
|
GameEvent::PickupEventFunction onPickupEventFnc;
|
||||||
|
GameEvent::CollisionEventFunction onCollisionEventFnc;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace GameLogic
|
||||||
typedef void(*ObjectDeadFunction)(IObjectData* victim, IObjectData* killer, float seconds); // Callback method that sends killer and death timer
|
typedef void(*ObjectDeadFunction)(IObjectData* victim, IObjectData* killer, float seconds); // Callback method that sends killer and death timer
|
||||||
typedef void(*PickupEventFunction)(IObjectData* player, int pickupEffectID ); // Callback method that sends killer and death timer
|
typedef void(*PickupEventFunction)(IObjectData* player, int pickupEffectID ); // Callback method that sends killer and death timer
|
||||||
typedef void(*AnimationEventFunction)(IObjectData* player, int actionID ); // Callback method that sends killer and death timer
|
typedef void(*AnimationEventFunction)(IObjectData* player, int actionID ); // Callback method that sends killer and death timer
|
||||||
|
typedef void(*CollisionEventFunction)(IObjectData*object, int collisionID);
|
||||||
//etc...
|
//etc...
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -188,7 +189,7 @@ namespace GameLogic
|
||||||
virtual void SetDeadSubscription(GameEvent::ObjectDeadFunction functionPointer) = 0;
|
virtual void SetDeadSubscription(GameEvent::ObjectDeadFunction functionPointer) = 0;
|
||||||
virtual void SetActionSubscription(GameEvent::AnimationEventFunction functionPointer) = 0;
|
virtual void SetActionSubscription(GameEvent::AnimationEventFunction functionPointer) = 0;
|
||||||
virtual void SetPickupSubscription(GameEvent::PickupEventFunction functionPointer) = 0;
|
virtual void SetPickupSubscription(GameEvent::PickupEventFunction functionPointer) = 0;
|
||||||
|
virtual void SetCollisionSubscription(GameEvent::CollisionEventFunction functionPointer) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,11 @@ using namespace Oyster::Math;
|
||||||
|
|
||||||
Level::Level(void)
|
Level::Level(void)
|
||||||
{
|
{
|
||||||
objID = 100;
|
srand (time(NULL));
|
||||||
|
objIDCounter = 100;
|
||||||
}
|
}
|
||||||
Level::~Level(void)
|
Level::~Level(void)
|
||||||
{
|
{
|
||||||
delete this->levelObj;
|
|
||||||
this->levelObj = NULL;
|
|
||||||
}
|
}
|
||||||
Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +30,7 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
{
|
{
|
||||||
case ObjectSpecialType_None:
|
case ObjectSpecialType_None:
|
||||||
{
|
{
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -49,22 +48,22 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
float worldSize = ((WorldAttributes*)obj)->worldSize;
|
float worldSize = ((WorldAttributes*)obj)->worldSize;
|
||||||
float atmosphereSize = ((WorldAttributes*)obj)->atmoSphereSize;
|
float atmosphereSize = ((WorldAttributes*)obj)->atmoSphereSize;
|
||||||
|
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_Building:
|
case ObjectSpecialType_Building:
|
||||||
{
|
{
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_Stone:
|
case ObjectSpecialType_Stone:
|
||||||
{
|
{
|
||||||
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_StandardBox:
|
case ObjectSpecialType_StandardBox:
|
||||||
{
|
{
|
||||||
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_RedExplosiveBox:
|
case ObjectSpecialType_RedExplosiveBox:
|
||||||
|
@ -72,7 +71,7 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
Oyster::Math::Float dmg = 120;
|
Oyster::Math::Float dmg = 120;
|
||||||
Oyster::Math::Float force = 500;
|
Oyster::Math::Float force = 500;
|
||||||
Oyster::Math::Float radie = 3;
|
Oyster::Math::Float radie = 3;
|
||||||
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID++, dmg, force, radie);
|
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter, dmg, force, radie);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//case ObjectSpecialType_BlueExplosiveBox:
|
//case ObjectSpecialType_BlueExplosiveBox:
|
||||||
|
@ -81,24 +80,24 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
// break;
|
// break;
|
||||||
case ObjectSpecialType_SpikeBox:
|
case ObjectSpecialType_SpikeBox:
|
||||||
{
|
{
|
||||||
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_Spike:
|
case ObjectSpecialType_Spike:
|
||||||
{
|
{
|
||||||
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_CrystalFormation:
|
case ObjectSpecialType_CrystalFormation:
|
||||||
{
|
{
|
||||||
int dmg = 50;
|
int dmg = 50;
|
||||||
//gameObj = new Crystal(rigidBody);
|
//gameObj = new Crystal(rigidBody);
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_CrystalShard:
|
case ObjectSpecialType_CrystalShard:
|
||||||
{
|
{
|
||||||
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new DynamicObject(rigidBody, DynamicObject::DynamicDefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_JumpPad:
|
case ObjectSpecialType_JumpPad:
|
||||||
|
@ -106,39 +105,28 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
float power = 500; //((JumpPadAttributes*)obj)->power;
|
float power = 500; //((JumpPadAttributes*)obj)->power;
|
||||||
Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction;
|
Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction;
|
||||||
Oyster::Math::Float3 pushForce = dir * power;
|
Oyster::Math::Float3 pushForce = dir * power;
|
||||||
gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID , pushForce);
|
gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter , pushForce);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_Portal:
|
case ObjectSpecialType_Portal:
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 destination = ((PortalAttributes*)obj)->destination;
|
Oyster::Math::Float3 destination = ((PortalAttributes*)obj)->destination;
|
||||||
gameObj = new Portal(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID, destination);
|
gameObj = new Portal(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter, destination);
|
||||||
}
|
|
||||||
break;
|
|
||||||
//case ObjectSpecialType_SpawnPoint:
|
|
||||||
//{
|
|
||||||
// save
|
|
||||||
|
|
||||||
//}
|
|
||||||
break;
|
|
||||||
case ObjectSpecialType_Player:
|
|
||||||
{
|
|
||||||
// should not be read from the lvl format
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_Generic:
|
case ObjectSpecialType_Generic:
|
||||||
{
|
{
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_PickupHealth:
|
case ObjectSpecialType_PickupHealth:
|
||||||
{
|
{
|
||||||
gameObj = new PickupHealth(rigidBody, obj->specialTypeID, objID, ((PickupHealthAttributes*)obj)->spawnTime, ((PickupHealthAttributes*)obj)->healthValue);
|
gameObj = new PickupHealth(rigidBody, obj->specialTypeID, objIDCounter, ((PickupHealthAttributes*)obj)->spawnTime, ((PickupHealthAttributes*)obj)->healthValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID);
|
gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -264,7 +252,7 @@ bool Level::InitiateLevel(std::wstring levelPath)
|
||||||
|
|
||||||
for (int i = 0; i < objCount; i++)
|
for (int i = 0; i < objCount; i++)
|
||||||
{
|
{
|
||||||
++this->objID;
|
++this->objIDCounter;
|
||||||
ObjectTypeHeader* obj = objects.at(i);
|
ObjectTypeHeader* obj = objects.at(i);
|
||||||
switch (obj->typeID)
|
switch (obj->typeID)
|
||||||
{
|
{
|
||||||
|
@ -272,6 +260,7 @@ bool Level::InitiateLevel(std::wstring levelPath)
|
||||||
{
|
{
|
||||||
LevelMetaData* LevelObjData = ((LevelMetaData*)obj);
|
LevelMetaData* LevelObjData = ((LevelMetaData*)obj);
|
||||||
std::string levelName = LevelObjData->levelName;
|
std::string levelName = LevelObjData->levelName;
|
||||||
|
|
||||||
// LevelObjData->worldSize;
|
// LevelObjData->worldSize;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -372,71 +361,6 @@ bool Level::InitiateLevel(std::wstring levelPath)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool Level::InitiateLevel(float radius)
|
|
||||||
{
|
|
||||||
API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0));
|
|
||||||
API::Instance().SetGravity(200);
|
|
||||||
int idCount = 100;
|
|
||||||
// add level sphere
|
|
||||||
ICustomBody* rigidBody = API::Instance().AddCollisionSphere(599.2f, Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f);
|
|
||||||
|
|
||||||
levelObj = new StaticObject(rigidBody, LevelCollisionAfter, ObjectSpecialType_World, idCount++);
|
|
||||||
|
|
||||||
//this->levelObj->objectID = idCount++;
|
|
||||||
rigidBody->SetCustomTag(levelObj);
|
|
||||||
|
|
||||||
|
|
||||||
ICustomBody* rigidBody_TestBox;
|
|
||||||
|
|
||||||
int nrOfBoxex = 5;
|
|
||||||
int offset = 0;
|
|
||||||
for(int i =0; i< nrOfBoxex; i ++)
|
|
||||||
{
|
|
||||||
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(0.0f, 605.0f + i*5.0f, 10.0f), 5.0f, 0.5f, 0.8f, 0.6f);
|
|
||||||
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox, Object::DefaultOnCollision, ObjectSpecialType_StandardBox, idCount++));
|
|
||||||
}
|
|
||||||
/*offset += nrOfBoxex;
|
|
||||||
for(int i =0; i< nrOfBoxex; i ++)
|
|
||||||
{
|
|
||||||
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0,5, -605 -( i*5)), 5);
|
|
||||||
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultOnCollision, OBJECT_TYPE::OBJECT_TYPE_BOX));
|
|
||||||
rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]);
|
|
||||||
|
|
||||||
}
|
|
||||||
offset += nrOfBoxex;
|
|
||||||
for(int i =0; i< nrOfBoxex; i ++)
|
|
||||||
{
|
|
||||||
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(200, 620 + ( i*7), 0), 5);
|
|
||||||
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultOnCollision, OBJECT_TYPE::OBJECT_TYPE_BOX));
|
|
||||||
rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]);
|
|
||||||
}
|
|
||||||
offset += nrOfBoxex;
|
|
||||||
for(int i =0; i< nrOfBoxex; i ++)
|
|
||||||
{
|
|
||||||
rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(5, 605 + i*5, 0), 5);
|
|
||||||
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultOnCollision, OBJECT_TYPE::OBJECT_TYPE_BOX));
|
|
||||||
rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i]);
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// add crystal
|
|
||||||
ICustomBody* rigidBody_Crystal = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(10.0f, 605.0f, 0.0f), 5.0f, 0.5f, 0.8f, 0.6f);
|
|
||||||
this->dynamicObjects.Push(new DynamicObject(rigidBody_Crystal, Object::DefaultOnCollision, ObjectSpecialType_StandardBox, idCount++));
|
|
||||||
|
|
||||||
// add house
|
|
||||||
ICustomBody* rigidBody_House =API::Instance().AddCollisionBox(Oyster::Math::Float3(20.0f, 20.0f, 20.0f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(-50.0f, 590.0f, 0.0f), 0.0f, 0.5f, 0.8f, 0.6f);
|
|
||||||
this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultOnCollision, ObjectSpecialType_Generic, idCount++));
|
|
||||||
|
|
||||||
// add jumppad
|
|
||||||
|
|
||||||
ICustomBody* rigidBody_Jumppad = API::Instance().AddCollisionBox(Oyster::Math::Float3(1.0f, 1.0f, 1.0f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(4.0f, 600.3f, 0.0f), 5.0f, 0.5f, 0.8f, 0.6f);
|
|
||||||
this->staticObjects.Push(new JumpPad(rigidBody_Jumppad, ObjectSpecialType_JumpPad,idCount++ ,Oyster::Math::Float3(0,2000,0)));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Level::AddPlayerToTeam(Player *player, int teamID)
|
void Level::AddPlayerToTeam(Player *player, int teamID)
|
||||||
{
|
{
|
||||||
|
@ -444,6 +368,15 @@ void Level::AddPlayerToTeam(Player *player, int teamID)
|
||||||
}
|
}
|
||||||
void Level::AddPlayerToGame(Player *player)
|
void Level::AddPlayerToGame(Player *player)
|
||||||
{
|
{
|
||||||
|
for(int i = 0; i < (int)this->playerObjects.Size(); i++)
|
||||||
|
{
|
||||||
|
if (!this->playerObjects[i])
|
||||||
|
{
|
||||||
|
this->playerObjects[i] = player;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if no free space, allocate a new spot
|
||||||
this->playerObjects.Push(player);
|
this->playerObjects.Push(player);
|
||||||
}
|
}
|
||||||
void Level::RemovePlayerFromGame(Player *player)
|
void Level::RemovePlayerFromGame(Player *player)
|
||||||
|
@ -452,7 +385,7 @@ void Level::RemovePlayerFromGame(Player *player)
|
||||||
{
|
{
|
||||||
if ((Player*)this->playerObjects[i] == player)
|
if ((Player*)this->playerObjects[i] == player)
|
||||||
{
|
{
|
||||||
//this->playerObjects[i].
|
this->playerObjects[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,14 +398,22 @@ void Level::RespawnPlayer(Player *player)
|
||||||
{
|
{
|
||||||
//this->teamManager.RespawnPlayerRandom(player);
|
//this->teamManager.RespawnPlayerRandom(player);
|
||||||
|
|
||||||
Float3 spawnPoint = spawnPoints[0];
|
int i = rand() % spawnPoints.Size();
|
||||||
|
Float3 spawnPoint = spawnPoints[i];
|
||||||
player->Respawn(spawnPoint);
|
player->Respawn(spawnPoint);
|
||||||
}
|
}
|
||||||
void Level::Update(float deltaTime)
|
void Level::Update(float deltaTime)
|
||||||
{
|
{
|
||||||
// update lvl-things
|
// update lvl-things
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < (int)this->playerObjects.Size(); i++)
|
for(int i = 0; i < (int)this->playerObjects.Size(); i++)
|
||||||
{
|
{
|
||||||
|
if(this->playerObjects[i]->getAffectingPlayer() != NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (this->playerObjects[i]->GetState() == PLAYER_STATE::PLAYER_STATE_DEAD)
|
if (this->playerObjects[i]->GetState() == PLAYER_STATE::PLAYER_STATE_DEAD)
|
||||||
{
|
{
|
||||||
// true when timer reaches 0
|
// true when timer reaches 0
|
||||||
|
@ -483,9 +424,41 @@ void Level::Update(float deltaTime)
|
||||||
{
|
{
|
||||||
this->playerObjects[i]->setDeathTimer(DEATH_TIMER);
|
this->playerObjects[i]->setDeathTimer(DEATH_TIMER);
|
||||||
// HACK to avoid crasch. affected by tag is NULL
|
// HACK to avoid crasch. affected by tag is NULL
|
||||||
|
//((Game*)&Game::Instance())->onDeadFnc(this->playerObjects[i], this->playerObjects[i], DEATH_TIMER); // add killer ID
|
||||||
Player* killer = this->playerObjects[i]->getAffectingPlayer();
|
Player* killer = this->playerObjects[i]->getAffectingPlayer();
|
||||||
((Game*)&Game::Instance())->onDeadFnc(this->playerObjects[i], this->playerObjects[i], DEATH_TIMER); // add killer ID
|
if(!killer) //if there is no killer then you commited suicide
|
||||||
//((Game*)&Game::Instance())->onDeadFnc(this->playerObjects[i], this->playerObjects[i]->getAffectingPlayer(), DEATH_TIMER); // add killer ID
|
{
|
||||||
|
killer = this->playerObjects[i];
|
||||||
|
}
|
||||||
|
((Game*)&Game::Instance())->onDeadFnc(this->playerObjects[i], killer, DEATH_TIMER); // add killer ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < dynamicObjects.Size(); i++)
|
||||||
|
{
|
||||||
|
if(dynamicObjects[i]->getAffectingPlayer() != NULL)
|
||||||
|
{
|
||||||
|
Oyster::Math::Float vel = dynamicObjects[i]->GetRigidBody()->GetLinearVelocity().GetMagnitude();
|
||||||
|
|
||||||
|
if(vel <= 0.1f) // is bearly moving
|
||||||
|
{
|
||||||
|
//set the tag AffectedBy to NULL
|
||||||
|
dynamicObjects[i]->RemoveAffectedBy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < playerObjects.Size(); i++)
|
||||||
|
{
|
||||||
|
if(playerObjects[i]->getAffectingPlayer() != NULL)
|
||||||
|
{
|
||||||
|
Oyster::Math::Float vel = playerObjects[i]->GetRigidBody()->GetLinearVelocity().GetMagnitude();
|
||||||
|
|
||||||
|
if(vel <= 0.1f) // is bearly moving
|
||||||
|
{
|
||||||
|
//set the tag AffectedBy to NULL
|
||||||
|
playerObjects[i]->RemoveAffectedBy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +484,7 @@ void Level::PhysicsOnMoveLevel(const ICustomBody *object)
|
||||||
Object* temp = (Object*)object->GetCustomTag();
|
Object* temp = (Object*)object->GetCustomTag();
|
||||||
((Game*)&Game::Instance())->onMoveFnc(temp);
|
((Game*)&Game::Instance())->onMoveFnc(temp);
|
||||||
}
|
}
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<Player>> Level::GetPlayers()
|
Utility::DynamicMemory::DynamicArray<Player*> Level::GetPlayers()
|
||||||
{
|
{
|
||||||
return this->playerObjects;
|
return this->playerObjects;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ namespace GameLogic
|
||||||
* @param levelPath: Path to a file that contains all information on the level
|
* @param levelPath: Path to a file that contains all information on the level
|
||||||
********************************************************/
|
********************************************************/
|
||||||
bool InitiateLevel(std::wstring levelPath);
|
bool InitiateLevel(std::wstring levelPath);
|
||||||
bool InitiateLevel(float radius);
|
|
||||||
Oyster::Physics::ICustomBody* InitRigidBodyCube( const ObjectHeader* obj);
|
Oyster::Physics::ICustomBody* InitRigidBodyCube( const ObjectHeader* obj);
|
||||||
Oyster::Physics::ICustomBody* InitRigidBodySphere( const ObjectHeader* obj);
|
Oyster::Physics::ICustomBody* InitRigidBodySphere( const ObjectHeader* obj);
|
||||||
Oyster::Physics::ICustomBody* InitRigidBodyMesh( const ObjectHeader* obj);
|
Oyster::Physics::ICustomBody* InitRigidBodyMesh( const ObjectHeader* obj);
|
||||||
|
@ -79,19 +78,19 @@ namespace GameLogic
|
||||||
static void PlayerDied( Player* player );
|
static void PlayerDied( Player* player );
|
||||||
static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object);
|
static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object);
|
||||||
|
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<Player>> GetPlayers();
|
Utility::DynamicMemory::DynamicArray<Player*> GetPlayers();
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> GetStaticObjects();
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> GetStaticObjects();
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> GetDynamicObject();
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> GetDynamicObject();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<Player>> playerObjects;
|
Utility::DynamicMemory::DynamicArray<Player*> playerObjects;
|
||||||
TeamManager teamManager;
|
TeamManager teamManager;
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> staticObjects;
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> staticObjects;
|
||||||
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> dynamicObjects;
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> dynamicObjects;
|
||||||
GameModeType gameMode;
|
GameModeType gameMode;
|
||||||
Utility::DynamicMemory::SmartPointer<Oyster::Physics::ICustomBody> rigidBodyLevel;
|
//Utility::DynamicMemory::SmartPointer<Oyster::Physics::ICustomBody> rigidBodyLevel;
|
||||||
StaticObject *levelObj;
|
// //StaticObject *levelObj;
|
||||||
int objID;
|
int objIDCounter;
|
||||||
Utility::DynamicMemory::DynamicArray<Oyster::Math::Float3> spawnPoints;
|
Utility::DynamicMemory::DynamicArray<Oyster::Math::Float3> spawnPoints;
|
||||||
PickupSystem pickupSystem;
|
PickupSystem pickupSystem;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ Pickup::Pickup(Oyster::Physics::ICustomBody *rigidBody, EventOnCollision collisi
|
||||||
this->active = true;
|
this->active = true;
|
||||||
this->spawnTime = spawnTime;
|
this->spawnTime = spawnTime;
|
||||||
timer.reset();
|
timer.reset();
|
||||||
|
this->GetRigidBody()->MoveToLimbo();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pickup::~Pickup()
|
Pickup::~Pickup()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "PickupHealth.h"
|
#include "PickupHealth.h"
|
||||||
|
#include "../Game.h"
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
@ -14,5 +15,8 @@ PickupHealth::~PickupHealth()
|
||||||
void PickupHealth::OnCollision(Player *player)
|
void PickupHealth::OnCollision(Player *player)
|
||||||
{
|
{
|
||||||
timer.reset();
|
timer.reset();
|
||||||
|
((Game*)&Game::Instance())->onDisableFnc(this);
|
||||||
|
|
||||||
|
this->active = false;
|
||||||
player->DamageLife(-hpValue);
|
player->DamageLife(-hpValue);
|
||||||
}
|
}
|
|
@ -8,11 +8,11 @@ using namespace GameLogic;
|
||||||
using namespace Oyster::Physics;
|
using namespace Oyster::Physics;
|
||||||
const float MOVE_FORCE = 30;
|
const float MOVE_FORCE = 30;
|
||||||
const float KEY_TIMER = 0.03f;
|
const float KEY_TIMER = 0.03f;
|
||||||
|
const float AFFECTED_TIMER = 1.0f;
|
||||||
Player::Player()
|
Player::Player()
|
||||||
:DynamicObject()
|
:DynamicObject()
|
||||||
{
|
{
|
||||||
Player::initPlayerData();
|
Player::initPlayerData();
|
||||||
AffectedObjects.Reserve(15);
|
|
||||||
this->weapon = NULL;
|
this->weapon = NULL;
|
||||||
this->teamID = -1;
|
this->teamID = -1;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)
|
||||||
{
|
{
|
||||||
this->weapon = new Weapon(2,this);
|
this->weapon = new Weapon(2,this);
|
||||||
Player::initPlayerData();
|
Player::initPlayerData();
|
||||||
AffectedObjects.Reserve(15);
|
|
||||||
this->teamID = teamID;
|
this->teamID = teamID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,16 +30,15 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustom
|
||||||
{
|
{
|
||||||
this->weapon = new Weapon(2,this);
|
this->weapon = new Weapon(2,this);
|
||||||
Player::initPlayerData();
|
Player::initPlayerData();
|
||||||
AffectedObjects.Reserve(15);
|
|
||||||
this->teamID = teamID;
|
this->teamID = teamID;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
{
|
{
|
||||||
if(weapon)
|
if(this->weapon)
|
||||||
{
|
{
|
||||||
delete weapon;
|
delete this->weapon;
|
||||||
weapon = NULL;
|
this->weapon = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Player::initPlayerData()
|
void Player::initPlayerData()
|
||||||
|
@ -57,7 +55,7 @@ void Player::initPlayerData()
|
||||||
this->key_strafeRight = 0;
|
this->key_strafeRight = 0;
|
||||||
this->key_strafeLeft = 0;
|
this->key_strafeLeft = 0;
|
||||||
this->key_jump = 0;
|
this->key_jump = 0;
|
||||||
this->invincibleCooldown = 0;
|
this->RecentlyAffected = 0;
|
||||||
this->deathTimer = 0;
|
this->deathTimer = 0;
|
||||||
|
|
||||||
this->rotationUp = 0;
|
this->rotationUp = 0;
|
||||||
|
@ -65,16 +63,19 @@ void Player::initPlayerData()
|
||||||
|
|
||||||
void Player::BeginFrame()
|
void Player::BeginFrame()
|
||||||
{
|
{
|
||||||
if( this->playerState != PLAYER_STATE_DEAD && PLAYER_STATE_DIED)
|
if( this->playerState != PLAYER_STATE_DEAD && this->playerState != PLAYER_STATE_DIED)
|
||||||
{
|
{
|
||||||
weapon->Update(0.002f);
|
weapon->Update(0.002f);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Oyster::Math::Float maxSpeed = 30;
|
Oyster::Math::Float maxSpeed = 30;
|
||||||
|
|
||||||
// Rotate player accordingly
|
// Rotate player accordingly
|
||||||
this->rigidBody->AddRotationAroundY(this->rotationUp);
|
this->rigidBody->AddRotationAroundY(this->rotationUp);
|
||||||
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
|
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
|
||||||
this->rotationUp = 0.0f;
|
this->rotationUp = 0;
|
||||||
// Direction data
|
// Direction data
|
||||||
Oyster::Math::Float4x4 xform;
|
Oyster::Math::Float4x4 xform;
|
||||||
xform = this->rigidBody->GetState().GetOrientation();
|
xform = this->rigidBody->GetState().GetOrientation();
|
||||||
|
@ -138,7 +139,7 @@ void Player::BeginFrame()
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
{
|
{
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_IDLE)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_IDLE)
|
||||||
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Idle);
|
this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Idle);
|
||||||
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +175,7 @@ void Player::BeginFrame()
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
{
|
{
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_WALKING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_WALKING)
|
||||||
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Walk);
|
this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Walk);
|
||||||
this->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
this->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +197,7 @@ void Player::BeginFrame()
|
||||||
this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass * 20);
|
this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass * 20);
|
||||||
|
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Jump);
|
this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Jump);
|
||||||
this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING;
|
this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +205,7 @@ void Player::BeginFrame()
|
||||||
{
|
{
|
||||||
if(this->playerState == PLAYER_STATE::PLAYER_STATE_JUMPING)
|
if(this->playerState == PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
{
|
{
|
||||||
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Idle);
|
this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Idle);
|
||||||
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,16 +214,6 @@ void Player::BeginFrame()
|
||||||
|
|
||||||
void Player::EndFrame()
|
void Player::EndFrame()
|
||||||
{
|
{
|
||||||
//check if there are any objects that can be removed from the AffectedObjects list
|
|
||||||
for(int i = 0; i < this->AffectedObjects.Size(); i++)
|
|
||||||
{
|
|
||||||
if(this->AffectedObjects[i] && (this->AffectedObjects[i]->GetRigidBody()->GetState().previousVelocity).GetMagnitude() <= 0.1f)
|
|
||||||
{
|
|
||||||
this->AffectedObjects[i]->RemoveAffectedBy();
|
|
||||||
this->AffectedObjects.Remove(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Move(const PLAYER_MOVEMENT &movement)
|
void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
|
@ -292,7 +283,7 @@ void Player::SetLookDir(const Oyster::Math3D::Float3& lookDir)
|
||||||
}
|
}
|
||||||
void Player::TurnLeft(Oyster::Math3D::Float deltaRadians)
|
void Player::TurnLeft(Oyster::Math3D::Float deltaRadians)
|
||||||
{
|
{
|
||||||
this->rotationUp = deltaRadians;
|
this->rotationUp += deltaRadians;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Jump()
|
void Player::Jump()
|
||||||
|
@ -341,7 +332,13 @@ PLAYER_STATE Player::GetState() const
|
||||||
|
|
||||||
void Player::DamageLife(int damage)
|
void Player::DamageLife(int damage)
|
||||||
{
|
{
|
||||||
|
if(damage != 0)
|
||||||
|
{
|
||||||
this->playerStats.hp -= damage;
|
this->playerStats.hp -= damage;
|
||||||
|
|
||||||
|
if(this->playerStats.hp > 100)
|
||||||
|
this->playerStats.hp = 100;
|
||||||
|
|
||||||
// send hp to client
|
// send hp to client
|
||||||
this->gameInstance->onDamageTakenFnc( this, this->playerStats.hp);
|
this->gameInstance->onDamageTakenFnc( this, this->playerStats.hp);
|
||||||
|
|
||||||
|
@ -350,23 +347,9 @@ void Player::DamageLife(int damage)
|
||||||
this->playerStats.hp = 0;
|
this->playerStats.hp = 0;
|
||||||
this->playerState = PLAYER_STATE_DIED;
|
this->playerState = PLAYER_STATE_DIED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::AddAffectedObject(DynamicObject &AffectedObject)
|
|
||||||
{
|
|
||||||
//check if object already exists in the list, if so then do not add
|
|
||||||
for(int i = 0; i < AffectedObjects.Size(); i++)
|
|
||||||
{
|
|
||||||
if(AffectedObjects[i]->GetID() == AffectedObject.GetID())
|
|
||||||
{
|
|
||||||
//object already exists, exit function
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//else you add the object to the stack
|
|
||||||
AffectedObjects.Push(&AffectedObject);
|
|
||||||
}
|
|
||||||
bool Player::deathTimerTick(float dt)
|
bool Player::deathTimerTick(float dt)
|
||||||
{
|
{
|
||||||
this->deathTimer -= dt;
|
this->deathTimer -= dt;
|
||||||
|
|
|
@ -68,8 +68,6 @@ namespace GameLogic
|
||||||
|
|
||||||
void TurnLeft(Oyster::Math3D::Float deltaRadians);
|
void TurnLeft(Oyster::Math3D::Float deltaRadians);
|
||||||
|
|
||||||
void AddAffectedObject(DynamicObject &AffectedObject);
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Collision function for player, this is to be sent to physics through the subscribe function with the rigidbody
|
* Collision function for player, this is to be sent to physics through the subscribe function with the rigidbody
|
||||||
* Will be called when the physics detect a collision
|
* Will be called when the physics detect a collision
|
||||||
|
@ -90,6 +88,7 @@ namespace GameLogic
|
||||||
Oyster::Math::Float4x4 GetOrientation() const;
|
Oyster::Math::Float4x4 GetOrientation() const;
|
||||||
int GetTeamID() const;
|
int GetTeamID() const;
|
||||||
PLAYER_STATE GetState() const;
|
PLAYER_STATE GetState() const;
|
||||||
|
Oyster::Math::Float GetRecentlyAffected();
|
||||||
|
|
||||||
void DamageLife(int damage);
|
void DamageLife(int damage);
|
||||||
void setDeathTimer(float deathTimer);
|
void setDeathTimer(float deathTimer);
|
||||||
|
@ -104,8 +103,6 @@ namespace GameLogic
|
||||||
void initPlayerData();
|
void initPlayerData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Utility::DynamicMemory::DynamicArray<DynamicObject*> AffectedObjects;
|
|
||||||
int teamID;
|
int teamID;
|
||||||
Weapon *weapon;
|
Weapon *weapon;
|
||||||
PLAYER_STATE playerState;
|
PLAYER_STATE playerState;
|
||||||
|
@ -122,7 +119,7 @@ namespace GameLogic
|
||||||
float deathTimer;
|
float deathTimer;
|
||||||
|
|
||||||
bool hasTakenDamage;
|
bool hasTakenDamage;
|
||||||
float invincibleCooldown;
|
Oyster::Math::Float RecentlyAffected;
|
||||||
PlayerStats playerStats;
|
PlayerStats playerStats;
|
||||||
PlayerScore playerScore;
|
PlayerScore playerScore;
|
||||||
|
|
||||||
|
|
|
@ -969,7 +969,7 @@ namespace GameLogic
|
||||||
Oyster::Network::CustomNetProtocol protocol;
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
//#define protocol_Gameplay_ObjectAction 369
|
//#define protocol_Gameplay_ObjectAction 369
|
||||||
struct Protocol_ObjectAction :public Oyster::Network::CustomProtocolObject
|
struct Protocol_ObjectAction :public Oyster::Network::CustomProtocolObject
|
||||||
{
|
{
|
||||||
short objectID;
|
short objectID;
|
||||||
|
@ -1010,4 +1010,46 @@ namespace GameLogic
|
||||||
private:
|
private:
|
||||||
Oyster::Network::CustomNetProtocol protocol;
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
};
|
};
|
||||||
|
//#define protocol_Gameplay_ObjectCollision 370
|
||||||
|
struct Protocol_ObjectCollision :public Oyster::Network::CustomProtocolObject
|
||||||
|
{
|
||||||
|
short objectID;
|
||||||
|
int collisionID;
|
||||||
|
// TODO: maybe position, impact, and velocity
|
||||||
|
|
||||||
|
Protocol_ObjectCollision()
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_Gameplay_ObjectCollision;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
|
||||||
|
this->objectID = -1;
|
||||||
|
this->collisionID = -1;
|
||||||
|
}
|
||||||
|
Protocol_ObjectCollision(Oyster::Network::CustomNetProtocol& p)
|
||||||
|
{
|
||||||
|
this->objectID = p[1].value.netShort;
|
||||||
|
this->collisionID = p[2].value.netInt;
|
||||||
|
}
|
||||||
|
Protocol_ObjectCollision( int id, int collisionID)
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_Gameplay_ObjectCollision;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
|
||||||
|
this->objectID = id;
|
||||||
|
this->collisionID = collisionID;
|
||||||
|
}
|
||||||
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
||||||
|
{
|
||||||
|
this->protocol[1].value = objectID;
|
||||||
|
this->protocol[2].value = collisionID;
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
|
@ -73,6 +73,7 @@
|
||||||
#define protocol_Gameplay_ObjectDie 367
|
#define protocol_Gameplay_ObjectDie 367
|
||||||
#define protocol_Gameplay_ObjectDisconnectPlayer 368
|
#define protocol_Gameplay_ObjectDisconnectPlayer 368
|
||||||
#define protocol_Gameplay_ObjectAction 369
|
#define protocol_Gameplay_ObjectAction 369
|
||||||
|
#define protocol_Gameplay_ObjectCollision 370
|
||||||
#define protocol_GameplayMAX 399
|
#define protocol_GameplayMAX 399
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,7 @@ namespace DanBias
|
||||||
static void ObjectDead ( GameLogic::IObjectData* victim, GameLogic::IObjectData* killer, float seconds );
|
static void ObjectDead ( GameLogic::IObjectData* victim, GameLogic::IObjectData* killer, float seconds );
|
||||||
static void PickupEvent ( GameLogic::IObjectData* movedObject, int pickupEffectID );
|
static void PickupEvent ( GameLogic::IObjectData* movedObject, int pickupEffectID );
|
||||||
static void ActionEvent ( GameLogic::IObjectData* movedObject , int actionID );
|
static void ActionEvent ( GameLogic::IObjectData* movedObject , int actionID );
|
||||||
|
static void CollisionEvent ( GameLogic::IObjectData* Object , int collisionID );
|
||||||
//Private member variables
|
//Private member variables
|
||||||
private:
|
private:
|
||||||
Utility::DynamicMemory::DynamicArray<gClient> gClients;
|
Utility::DynamicMemory::DynamicArray<gClient> gClients;
|
||||||
|
|
|
@ -25,9 +25,6 @@ GameClient::GameClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::Net
|
||||||
}
|
}
|
||||||
GameClient::~GameClient()
|
GameClient::~GameClient()
|
||||||
{
|
{
|
||||||
if(this->player)
|
|
||||||
this->player->Inactivate();
|
|
||||||
|
|
||||||
delete this->player;
|
delete this->player;
|
||||||
|
|
||||||
this->isReady = false;
|
this->isReady = false;
|
||||||
|
|
|
@ -152,7 +152,7 @@ using namespace DanBias;
|
||||||
}
|
}
|
||||||
void GameSession::ObjectEnabled( GameLogic::IObjectData* movedObject )
|
void GameSession::ObjectEnabled( GameLogic::IObjectData* movedObject )
|
||||||
{
|
{
|
||||||
GameSession::gameSession->Send(Protocol_ObjectDisable(movedObject->GetID()).GetProtocol());
|
GameSession::gameSession->Send(Protocol_ObjectEnable(movedObject->GetID()).GetProtocol());
|
||||||
}
|
}
|
||||||
void GameSession::ObjectDamaged( GameLogic::IObjectData* movedObject, float hp )
|
void GameSession::ObjectDamaged( GameLogic::IObjectData* movedObject, float hp )
|
||||||
{
|
{
|
||||||
|
@ -176,6 +176,11 @@ using namespace DanBias;
|
||||||
// send action protocol
|
// send action protocol
|
||||||
GameSession::gameSession->Send(Protocol_ObjectAction(movedObject->GetID(), actionID).GetProtocol());
|
GameSession::gameSession->Send(Protocol_ObjectAction(movedObject->GetID(), actionID).GetProtocol());
|
||||||
}
|
}
|
||||||
|
void GameSession::CollisionEvent( GameLogic::IObjectData* movedObject , int collisionID )
|
||||||
|
{
|
||||||
|
// send action protocol
|
||||||
|
GameSession::gameSession->Send(Protocol_ObjectCollision(movedObject->GetID(), collisionID).GetProtocol());
|
||||||
|
}
|
||||||
//*****************************************************//
|
//*****************************************************//
|
||||||
//****************** Protocol methods *****************//
|
//****************** Protocol methods *****************//
|
||||||
//******************************************************************************************************************//
|
//******************************************************************************************************************//
|
||||||
|
|
|
@ -114,6 +114,7 @@ bool GameSession::Create(GameDescription& desc, bool forceStart)
|
||||||
this->gameInstance.SetDeadSubscription(GameSession::ObjectDead);
|
this->gameInstance.SetDeadSubscription(GameSession::ObjectDead);
|
||||||
this->gameInstance.SetActionSubscription(GameSession::ActionEvent);
|
this->gameInstance.SetActionSubscription(GameSession::ActionEvent);
|
||||||
this->gameInstance.SetPickupSubscription(GameSession::PickupEvent);
|
this->gameInstance.SetPickupSubscription(GameSession::PickupEvent);
|
||||||
|
this->gameInstance.SetCollisionSubscription(GameSession::CollisionEvent);
|
||||||
this->gameInstance.SetFPS(60);
|
this->gameInstance.SetFPS(60);
|
||||||
|
|
||||||
this->description.clients.Clear();
|
this->description.clients.Clear();
|
||||||
|
|
|
@ -168,6 +168,14 @@ std::vector<SmartPointer<ObjectTypeHeader>> LevelParser::Parse(std::string filen
|
||||||
ParseObject(&buffer[counter], &header->healthValue, 4);
|
ParseObject(&buffer[counter], &header->healthValue, 4);
|
||||||
counter += 4;
|
counter += 4;
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
header->position[1] = 150;
|
||||||
|
header->spawnTime = 5;
|
||||||
|
header->boundingVolume.box.mass = 0;
|
||||||
|
header->typeID = ObjectType_Static;
|
||||||
|
header->healthValue = 50;
|
||||||
|
// !DEBUG
|
||||||
|
|
||||||
objects.push_back(header);
|
objects.push_back(header);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,16 +95,26 @@ namespace GameLogic
|
||||||
|
|
||||||
enum PlayerAction
|
enum PlayerAction
|
||||||
{
|
{
|
||||||
PlayerAction_Jump,
|
PlayerAction_Jump = 0,
|
||||||
PlayerAction_Walk,
|
PlayerAction_Walk = 1,
|
||||||
PlayerAction_Idle,
|
PlayerAction_Idle = 2,
|
||||||
};
|
};
|
||||||
|
// continue ID counting from playerAction
|
||||||
enum WeaponAction
|
enum WeaponAction
|
||||||
{
|
{
|
||||||
WeaponAtcion_PrimaryShoot,
|
WeaponAction_PrimaryShoot = 3,
|
||||||
WeaponAction_SecondaryShoot
|
WeaponAction_SecondaryShoot = 4,
|
||||||
|
WeaponAction_UtilityActivate = 5,
|
||||||
|
WeaponAction_Reload = 6,
|
||||||
|
WeaponAction_EnergyDepleted = 7,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: add more collision Events
|
||||||
|
enum CollisionEvent
|
||||||
|
{
|
||||||
|
CollisionEvent_BasicCollision,
|
||||||
|
};
|
||||||
enum PickupType
|
enum PickupType
|
||||||
{
|
{
|
||||||
PickupType_Health,
|
PickupType_Health,
|
||||||
|
|
|
@ -177,7 +177,6 @@ void SimpleRigidBody::AddRotationAroundY(::Oyster::Math::Float angle)
|
||||||
|
|
||||||
this->state.quaternion = Quaternion(Float3(quaternion.x(), quaternion.y(), quaternion.z()), quaternion.w());
|
this->state.quaternion = Quaternion(Float3(quaternion.x(), quaternion.y(), quaternion.z()), quaternion.w());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRigidBody::SetAngularFactor(Float factor)
|
void SimpleRigidBody::SetAngularFactor(Float factor)
|
||||||
{
|
{
|
||||||
this->rigidBody->setAngularFactor(factor);
|
this->rigidBody->setAngularFactor(factor);
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Oyster
|
||||||
void SetRotation(Math::Quaternion quaternion);
|
void SetRotation(Math::Quaternion quaternion);
|
||||||
void SetRotation(Math::Float3 eulerAngles);
|
void SetRotation(Math::Float3 eulerAngles);
|
||||||
void SetRotation(::Oyster::Math::Float4x4 rotation);
|
void SetRotation(::Oyster::Math::Float4x4 rotation);
|
||||||
void AddRotationAroundY(Math::Float angle);
|
void AddRotationAroundY(::Oyster::Math::Float angle);
|
||||||
void SetAngularFactor(Math::Float factor);
|
void SetAngularFactor(Math::Float factor);
|
||||||
void SetMass(Math::Float mass);
|
void SetMass(Math::Float mass);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue