+1
-1
Submodule assets updated: 8d180f2a54...1e7adc749e
@@ -7,6 +7,7 @@
|
||||
#include "Core/EPlayerDamage.h"
|
||||
#include "Core/EShoot.h"
|
||||
|
||||
|
||||
class AssaultWeaponBehaviour : public WeaponBehaviour
|
||||
{
|
||||
public:
|
||||
@@ -36,7 +37,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();
|
||||
|
||||
@@ -36,6 +36,7 @@ source_group(Network FILES ${SOURCE_FILES_Network})
|
||||
set(SOURCE_FILES
|
||||
${SOURCE_FILES}
|
||||
"Game.cpp"
|
||||
"MiniDump.cpp"
|
||||
${SOURCE_FILES_Systems}
|
||||
${SOURCE_FILES_Systems_Weapon}
|
||||
${SOURCE_FILES_Events}
|
||||
|
||||
@@ -38,12 +38,18 @@ 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;
|
||||
}
|
||||
|
||||
m_Reloading = true;
|
||||
m_ReloadTimer = cAssaultWeapon["ReloadTime"];
|
||||
playReloadAnimation();
|
||||
Events::PlaySoundOnEntity e;
|
||||
e.EmitterID = cAssaultWeapon.EntityID;
|
||||
e.FilePath = "Audio/weapon/reload.wav";
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
void AssaultWeaponBehaviour::Update(double dt)
|
||||
@@ -127,7 +133,7 @@ void AssaultWeaponBehaviour::fireRound()
|
||||
if (magAmmo <= 0) {
|
||||
Reload();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fire
|
||||
magAmmo -= 1;
|
||||
@@ -136,7 +142,7 @@ void AssaultWeaponBehaviour::fireRound()
|
||||
// Effects
|
||||
if (IsClient) {
|
||||
spawnTracer();
|
||||
playSound();
|
||||
playFireSound();
|
||||
viewPunch();
|
||||
playShootAnimation();
|
||||
bool hit = shoot(cAssaultWeapon["BaseDamage"]);
|
||||
@@ -182,7 +188,7 @@ float AssaultWeaponBehaviour::traceRayDistance(glm::vec3 origin, glm::vec3 direc
|
||||
}
|
||||
}
|
||||
|
||||
void AssaultWeaponBehaviour::playSound()
|
||||
void AssaultWeaponBehaviour::playFireSound()
|
||||
{
|
||||
if (!IsClient) {
|
||||
return;
|
||||
@@ -194,6 +200,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");
|
||||
@@ -386,5 +405,9 @@ void AssaultWeaponBehaviour::showHitMarker()
|
||||
EntityWrapper hitMarkerSpawner = m_Player.FirstChildByName("HitMarkerSpawner");
|
||||
if (hitMarkerSpawner.Valid()) {
|
||||
SpawnerSystem::Spawn(hitMarkerSpawner, hitMarkerSpawner);
|
||||
Events::PlaySoundOnEntity e;
|
||||
e.EmitterID = m_Player.ID;
|
||||
e.FilePath = "Audio/weapon/hitclick.wav";
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user