added reload animation and feature

This commit is contained in:
Mausham
2025-12-30 16:22:49 -08:00
parent 1a61f3c506
commit 0ec69f66c9
16 changed files with 27895 additions and 26896 deletions

View File

@@ -14,13 +14,13 @@ namespace Darkmatter.Presentation
[Header("Weapon Data")]
public float fireRate = 0.1f;
public int ammoCount = 40;
public override int AmmoCount { get; protected set; } = 40;
private float lastUsedTime;
public GameObject BulletHole;
public GameObject BulletHole;
public override string WeaponName => "Rifel";
public override bool canAttack => Time.time >= lastUsedTime + fireRate && ammoCount > 0;
public override bool canAttack => Time.time >= lastUsedTime + fireRate && AmmoCount > 0;
[Inject] private ITargetProvider targetProvider;
private RaycastHit hitPoint => targetProvider.hitPoint;
@@ -30,15 +30,10 @@ namespace Darkmatter.Presentation
public override void Attack()
{
lastUsedTime = Time.time;
ammoCount--;
AmmoCount--;
PlayMuzzleFlash();
if (hitPoint.transform != null) PlayBulletHitEffectParticle();
if(ammoCount <= 0) //test reload
{
Reload();
}
}
private void ShowBulletHole(Vector3 spawnPos)
@@ -66,7 +61,7 @@ namespace Darkmatter.Presentation
public override void Reload()
{
base.Reload();
ammoCount = 40;
AmmoCount = 40;
}
private void PlayMuzzleFlash()