testing updated

message to client about object creation, message to client about player
movement
This commit is contained in:
Erik Persson 2013-12-19 11:46:11 +01:00
parent 057dce0aca
commit e68001da0e
3 changed files with 41 additions and 5 deletions

View File

@ -143,9 +143,25 @@ using namespace GameLogic;
void GameSession::EricLogicInitFunc() void GameSession::EricLogicInitFunc()
{ {
//CollisionManager::BoxCollision(0,0); CollisionManager::BoxCollision(0,0);
objectBox = new DynamicObject(CollisionManager::BoxCollision, OBJECT_TYPE::OBJECT_TYPE_BOX);
Protocol_CreateObject objectCreation;
objectCreation.object_ID = objectBox->GetID();
objectCreation.path = "crate";
Oyster::Math::Float4x4 worldMat = objectBox->GetRigidBody()->GetOrientation();
for (int i = 0; i < 16; i++)
{
objectCreation.worldMatrix[i] = worldMat[i];
}
for (int i = 0; i < clients.Size(); i++)
{
clients[i]->NetClient_Object()->Send(objectCreation);
}
//objectBox = new DynamicObject(CollisionManager::BoxCollision, OBJECT_TYPE::OBJECT_TYPE_BOX);
} }
void GameSession::EricLogicFrameFunc() void GameSession::EricLogicFrameFunc()
{ {
@ -153,13 +169,31 @@ using namespace GameLogic;
} }
void GameSession::EricsLogicTestingProtocalRecieved(ClientObject* reciever, CustomNetProtocol& protocol) void GameSession::EricsLogicTestingProtocalRecieved(ClientObject* reciever, CustomNetProtocol& protocol)
{ {
bool moved = false;
switch (protocol[protocol_ID_INDEX].value.netShort) switch (protocol[protocol_ID_INDEX].value.netShort)
{ {
case protocol_Gameplay_PlayerNavigation: case protocol_Gameplay_PlayerNavigation:
ConvertToMovement(reciever, protocol); ConvertToMovement(reciever, protocol);
moved = true;
break; break;
} }
if (moved)
{
Protocol_ObjectPosition playerMovement;
Oyster::Math::Float4x4 worldMat = reciever->Logic_Object()->GetRigidBody()->GetOrientation();
playerMovement.object_ID = reciever->Logic_Object()->GetID();
for (int i = 0; i < 16; i++)
{
playerMovement.worldMatrix[i] = worldMat[i];
}
reciever->NetClient_Object()->Send(playerMovement);
}
} }

View File

@ -11,7 +11,7 @@ namespace GameLogic
struct Protocol_CreateObject :public Oyster::Network::CustomProtocolObject struct Protocol_CreateObject :public Oyster::Network::CustomProtocolObject
{ {
int object_ID; int object_ID;
char path[255]; char *path;
float worldMatrix[16]; float worldMatrix[16];

View File

@ -232,10 +232,12 @@ namespace Oyster
protected: protected:
virtual ~API() {} virtual ~API() {}
}; };
//! The root interface for all physical representations processable by the engine. //! The root interface for all physical representations processable by the engine.
class PHYSICS_DLL_USAGE ICustomBody class PHYSICS_DLL_USAGE ICustomBody
{ {
public: public:
enum SubscriptMessage enum SubscriptMessage
{ {