Now plays a "Empty sound", "reload sound" and "hit mark sound" on appropriate occasions.
This commit is contained in:
+1
-1
Submodule assets updated: 8d180f2a54...1e7adc749e
@@ -34,7 +34,8 @@ private:
|
||||
void fireRound();
|
||||
void spawnTracer();
|
||||
float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
|
||||
void playSound();
|
||||
void playFireSound();
|
||||
void playEmptySound();
|
||||
void viewPunch();
|
||||
void finishReload();
|
||||
void playShootAnimation();
|
||||
|
||||
@@ -175,6 +175,9 @@ bool PlayerSpawnSystem::OnPlayerDeath(Events::PlayerDeath& e)
|
||||
if ((ComponentInfo::EnumType)cTeam["Team"] == cTeam["Team"].Enum("Spectator")) {
|
||||
return false;
|
||||
}
|
||||
if (m_PlayerIDs.find(e.Player.ID) == m_PlayerIDs.end()) {
|
||||
return false;
|
||||
}
|
||||
SpawnRequest req;
|
||||
req.PlayerID = m_PlayerIDs.at(e.Player.ID);
|
||||
req.Team = cTeam["Team"];
|
||||
|
||||
@@ -37,6 +37,8 @@ void AssaultWeaponBehaviour::Reload()
|
||||
|
||||
// Don't reload if we're completly out of ammo
|
||||
if (ammo == 0) {
|
||||
playEmptySound();
|
||||
m_TimeSinceLastFire = -0.0f; // HACK: To make empty sound play with interval
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,12 +123,12 @@ void AssaultWeaponBehaviour::fireRound()
|
||||
if (magAmmo <= 0) {
|
||||
Reload();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fire
|
||||
magAmmo -= 1;
|
||||
spawnTracer();
|
||||
playSound();
|
||||
playFireSound();
|
||||
viewPunch();
|
||||
playShootAnimation();
|
||||
bool hit = shoot(cAssaultWeapon["BaseDamage"]);
|
||||
@@ -172,7 +174,7 @@ float AssaultWeaponBehaviour::traceRayDistance(glm::vec3 origin, glm::vec3 direc
|
||||
}
|
||||
}
|
||||
|
||||
void AssaultWeaponBehaviour::playSound()
|
||||
void AssaultWeaponBehaviour::playFireSound()
|
||||
{
|
||||
if (!IsClient) {
|
||||
return;
|
||||
@@ -184,6 +186,19 @@ void AssaultWeaponBehaviour::playSound()
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
|
||||
void AssaultWeaponBehaviour::playEmptySound()
|
||||
{
|
||||
if (!IsClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
Events::PlaySoundOnEntity e;
|
||||
e.EmitterID = m_Player.ID;
|
||||
e.FilePath = "Audio/weapon/zeroAmmo.wav";
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
void AssaultWeaponBehaviour::viewPunch()
|
||||
{
|
||||
EntityWrapper playerCamera = m_Player.FirstChildByName("Camera");
|
||||
@@ -342,7 +357,7 @@ void AssaultWeaponBehaviour::showHitMarker()
|
||||
if (hitMarkerSpawner.Valid()) {
|
||||
SpawnerSystem::Spawn(hitMarkerSpawner, hitMarkerSpawner);
|
||||
Events::PlaySoundOnEntity e;
|
||||
e.EmitterID = hitMarkerSpawner.ID; // This might not be the optimal spawner entity
|
||||
e.EmitterID = m_Player.ID;
|
||||
e.FilePath = "Audio/weapon/hitclick.wav";
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user