Test code
This commit is contained in:
@@ -112,7 +112,11 @@ void Client::SendSnapshotToServer()
|
|||||||
} else {
|
} else {
|
||||||
Package package(MessageType::Event, m_SendPacketID);
|
Package package(MessageType::Event, m_SendPacketID);
|
||||||
package.AddString("0Forward");
|
package.AddString("0Forward");
|
||||||
|
Send(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (m_NextSnapshot.InputRight != "") {
|
if (m_NextSnapshot.InputRight != "") {
|
||||||
Package package(MessageType::Event, m_SendPacketID);
|
Package package(MessageType::Event, m_SendPacketID);
|
||||||
package.AddString(m_NextSnapshot.InputRight);
|
package.AddString(m_NextSnapshot.InputRight);
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ void Server::ParseEvent(char * data, size_t length)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int entityId = m_PlayerDefinitions[i].EntityID;
|
unsigned int entityId = m_PlayerDefinitions[i].EntityID;
|
||||||
|
std::string templalala = std::string(data);
|
||||||
|
|
||||||
if ("+Forward" == std::string(data)) {
|
if ("+Forward" == std::string(data)) {
|
||||||
m_World->GetComponent(entityId, "Player")["Forward"] = true;
|
m_World->GetComponent(entityId, "Player")["Forward"] = true;
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
void PlayerSystem::UpdateComponent(World * world, ComponentWrapper & player, double dt)
|
void PlayerSystem::UpdateComponent(World * world, ComponentWrapper & player, double dt)
|
||||||
{
|
{
|
||||||
(glm::vec3)player["Velocity"] = glm::vec3(0.f, 0.f, 0.f);
|
(glm::vec3)player["Velocity"] = glm::vec3(0.f, 0.f, 0.f);
|
||||||
if (player["Forward"]) {
|
if (static_cast<bool>(player["Forward"])== true) {
|
||||||
((glm::vec3&)player["Velocity"]).z = m_Speed * float(dt) * -1;
|
((glm::vec3&)player["Velocity"]).z = m_Speed * float(dt) * -1;
|
||||||
}
|
}
|
||||||
if (player["Left"]) {
|
if (static_cast<bool>(player["Left"]) == true) {
|
||||||
((glm::vec3&)player["Velocity"]).x = m_Speed * float(dt) * -1;
|
((glm::vec3&)player["Velocity"]).x = m_Speed * float(dt) * -1;
|
||||||
}
|
}
|
||||||
if (player["Back"]) {
|
if (static_cast<bool>(player["Back"]) == true) {
|
||||||
((glm::vec3&)player["Velocity"]).z = m_Speed * float(dt);
|
((glm::vec3&)player["Velocity"]).z = m_Speed * float(dt);
|
||||||
}
|
}
|
||||||
if (player["Right"]) {
|
if (static_cast<bool>(player["Right"]) == true) {
|
||||||
((glm::vec3&)player["Velocity"]).x = m_Speed * float(dt);
|
((glm::vec3&)player["Velocity"]).x = m_Speed * float(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user