Test code
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user