+1
-1
Submodule assets updated: 8d180f2a54...1e7adc749e
@@ -7,6 +7,7 @@
|
|||||||
#include "Core/EPlayerDamage.h"
|
#include "Core/EPlayerDamage.h"
|
||||||
#include "Core/EShoot.h"
|
#include "Core/EShoot.h"
|
||||||
|
|
||||||
|
|
||||||
class AssaultWeaponBehaviour : public WeaponBehaviour
|
class AssaultWeaponBehaviour : public WeaponBehaviour
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -36,7 +37,8 @@ private:
|
|||||||
void fireRound();
|
void fireRound();
|
||||||
void spawnTracer();
|
void spawnTracer();
|
||||||
float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
|
float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
|
||||||
void playSound();
|
void playFireSound();
|
||||||
|
void playEmptySound();
|
||||||
void viewPunch();
|
void viewPunch();
|
||||||
void finishReload();
|
void finishReload();
|
||||||
void playShootAnimation();
|
void playShootAnimation();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ source_group(Network FILES ${SOURCE_FILES_Network})
|
|||||||
set(SOURCE_FILES
|
set(SOURCE_FILES
|
||||||
${SOURCE_FILES}
|
${SOURCE_FILES}
|
||||||
"Game.cpp"
|
"Game.cpp"
|
||||||
|
"MiniDump.cpp"
|
||||||
${SOURCE_FILES_Systems}
|
${SOURCE_FILES_Systems}
|
||||||
${SOURCE_FILES_Systems_Weapon}
|
${SOURCE_FILES_Systems_Weapon}
|
||||||
${SOURCE_FILES_Events}
|
${SOURCE_FILES_Events}
|
||||||
|
|||||||
@@ -38,12 +38,18 @@ void AssaultWeaponBehaviour::Reload()
|
|||||||
|
|
||||||
// Don't reload if we're completly out of ammo
|
// Don't reload if we're completly out of ammo
|
||||||
if (ammo == 0) {
|
if (ammo == 0) {
|
||||||
|
playEmptySound();
|
||||||
|
m_TimeSinceLastFire = -0.0f; // HACK: To make empty sound play with interval
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Reloading = true;
|
m_Reloading = true;
|
||||||
m_ReloadTimer = cAssaultWeapon["ReloadTime"];
|
m_ReloadTimer = cAssaultWeapon["ReloadTime"];
|
||||||
playReloadAnimation();
|
playReloadAnimation();
|
||||||
|
Events::PlaySoundOnEntity e;
|
||||||
|
e.EmitterID = cAssaultWeapon.EntityID;
|
||||||
|
e.FilePath = "Audio/weapon/reload.wav";
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::Update(double dt)
|
void AssaultWeaponBehaviour::Update(double dt)
|
||||||
@@ -127,7 +133,7 @@ void AssaultWeaponBehaviour::fireRound()
|
|||||||
if (magAmmo <= 0) {
|
if (magAmmo <= 0) {
|
||||||
Reload();
|
Reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire
|
// Fire
|
||||||
magAmmo -= 1;
|
magAmmo -= 1;
|
||||||
@@ -136,7 +142,7 @@ void AssaultWeaponBehaviour::fireRound()
|
|||||||
// Effects
|
// Effects
|
||||||
if (IsClient) {
|
if (IsClient) {
|
||||||
spawnTracer();
|
spawnTracer();
|
||||||
playSound();
|
playFireSound();
|
||||||
viewPunch();
|
viewPunch();
|
||||||
playShootAnimation();
|
playShootAnimation();
|
||||||
bool hit = shoot(cAssaultWeapon["BaseDamage"]);
|
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) {
|
if (!IsClient) {
|
||||||
return;
|
return;
|
||||||
@@ -194,6 +200,19 @@ void AssaultWeaponBehaviour::playSound()
|
|||||||
m_EventBroker->Publish(e);
|
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()
|
void AssaultWeaponBehaviour::viewPunch()
|
||||||
{
|
{
|
||||||
EntityWrapper playerCamera = m_Player.FirstChildByName("Camera");
|
EntityWrapper playerCamera = m_Player.FirstChildByName("Camera");
|
||||||
@@ -386,5 +405,9 @@ void AssaultWeaponBehaviour::showHitMarker()
|
|||||||
EntityWrapper hitMarkerSpawner = m_Player.FirstChildByName("HitMarkerSpawner");
|
EntityWrapper hitMarkerSpawner = m_Player.FirstChildByName("HitMarkerSpawner");
|
||||||
if (hitMarkerSpawner.Valid()) {
|
if (hitMarkerSpawner.Valid()) {
|
||||||
SpawnerSystem::Spawn(hitMarkerSpawner, hitMarkerSpawner);
|
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