This commit is contained in:
stiffly
2016-03-03 21:23:53 +01:00
parent 1cc92f4800
commit 1227a795d7
2 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ private:
// To get a difference when calculating the walking state.
glm::vec3 m_LastPosition = glm::vec3();
// The logic for making the sound play when player is moving
void playerStep(double dt);
void playerStep(double dt, EntityWrapper player);
// Spawn a hexagon at origin of an Entity
void spawnHexagon(EntityWrapper target);
+3 -7
View File
@@ -242,10 +242,9 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
}
}
}
playerStep(dt, player);
controller->Reset();
}
playerStep(dt);
}
@@ -281,11 +280,8 @@ void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt)
position += velocity * (float)dt;
}
void PlayerMovementSystem::playerStep(double dt)
void PlayerMovementSystem::playerStep(double dt, EntityWrapper player)
{
if (!m_LocalPlayer.Valid()) {
return;
}
// Position of the local player, used see how far a player has moved.
glm::vec3 pos = (glm::vec3)m_World->GetComponent(m_LocalPlayer.ID, "Transform")["Position"];
// Used to see if a player is airborne.
@@ -298,7 +294,7 @@ void PlayerMovementSystem::playerStep(double dt)
// Create footstep sound
Events::PlaySoundOnEntity e;
e.Emitter = m_LocalPlayer;
e.FilePath = m_LeftFoot ? "Audio/footstep/footstep2.wav" : "Audio/footstep/footstep3.wav";
e.FilePath = m_LeftFoot ? "Audio/Footstep/Footstep2.wav" : "Audio/Footstep/Footstep3.wav";
m_LeftFoot = !m_LeftFoot;
m_EventBroker->Publish(e);
m_DistanceMoved = 0.f;