Test code

This commit is contained in:
stiffly
2015-12-15 17:55:08 +01:00
parent 082b3fd3df
commit 3f602c9d63
3 changed files with 9 additions and 4 deletions
+4
View File
@@ -112,7 +112,11 @@ void Client::SendSnapshotToServer()
} else {
Package package(MessageType::Event, m_SendPacketID);
package.AddString("0Forward");
Send(package);
}
if (m_NextSnapshot.InputRight != "") {
Package package(MessageType::Event, m_SendPacketID);
package.AddString(m_NextSnapshot.InputRight);
+1
View File
@@ -300,6 +300,7 @@ void Server::ParseEvent(char * data, size_t length)
return;
unsigned int entityId = m_PlayerDefinitions[i].EntityID;
std::string templalala = std::string(data);
if ("+Forward" == std::string(data)) {
m_World->GetComponent(entityId, "Player")["Forward"] = true;
+4 -4
View File
@@ -3,16 +3,16 @@
void PlayerSystem::UpdateComponent(World * world, ComponentWrapper & player, double dt)
{
(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;
}
if (player["Left"]) {
if (static_cast<bool>(player["Left"]) == true) {
((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);
}
if (player["Right"]) {
if (static_cast<bool>(player["Right"]) == true) {
((glm::vec3&)player["Velocity"]).x = m_Speed * float(dt);
}