diff --git a/Assets/Scripts/Managers/StatisticsManager.cs b/Assets/Scripts/Managers/StatisticsManager.cs index 5c78dffa200dbcd56d8f747c52cc431df9d6783b..c88d13fcbba162369ff1b45ca4c69cb5ea72c706 100644 --- a/Assets/Scripts/Managers/StatisticsManager.cs +++ b/Assets/Scripts/Managers/StatisticsManager.cs @@ -49,9 +49,9 @@ public class StatisticsManager : MonoBehaviour SaveStatistics(); } - public void ShotFired(int bullets) + public void ShotFired() { - shotsFired += bullets; + shotsFired++; Debug.Log("Shots fired this session: " + shotsFired); } diff --git a/Assets/Scripts/Weapon/MachinePistolAttack.cs b/Assets/Scripts/Weapon/MachinePistolAttack.cs index cc75ac2a36eca637d183b43925d9d94b1e749564..e18f3143d7fcb1a07478264892819d9146ab1a7a 100644 --- a/Assets/Scripts/Weapon/MachinePistolAttack.cs +++ b/Assets/Scripts/Weapon/MachinePistolAttack.cs @@ -50,7 +50,7 @@ public class MachinePistolAttack : MonoBehaviour GameObject projectile = Instantiate(projectilePrefab, projectilePoint.position, projectilePoint.rotation); projectile.GetComponent<ProjectileController>().damage = damage; projectile.GetComponent<ProjectileController>().ownerTag = owner.tag; - + if (owner.CompareTag("Player")) StatisticsManager.Instance.ShotFired(); audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Count)]); @@ -63,6 +63,5 @@ public class MachinePistolAttack : MonoBehaviour rb.AddForce(direction * shotForce, ForceMode.VelocityChange); lastShotTime = Time.time; - StatisticsManager.Instance.ShotFired(1); } } diff --git a/Assets/Scripts/Weapon/ShotgunAttack.cs b/Assets/Scripts/Weapon/ShotgunAttack.cs index 384fe8430f8ffcc479c940f58aa26c9b4ccd5452..65100a1e7725a42f2dcdbf7876704a59ab4350aa 100644 --- a/Assets/Scripts/Weapon/ShotgunAttack.cs +++ b/Assets/Scripts/Weapon/ShotgunAttack.cs @@ -92,6 +92,7 @@ public class ShotgunAttack : MonoBehaviour projectile.GetComponent<ProjectileController>().damage = damage; projectile.GetComponent<ProjectileController>().ownerTag = owner.tag; if(owner.CompareTag("Player")) projectile.GetComponent<ProjectileController>().isShotgunBullet = true; + if (owner.CompareTag("Player")) StatisticsManager.Instance.ShotFired(); } GameObject ammo; @@ -118,7 +119,6 @@ public class ShotgunAttack : MonoBehaviour lastShotTime = Time.time; Recoil(); - StatisticsManager.Instance.ShotFired(projectilesPerShot); } void Recoil()