separated weapon class left to separate logic and implementation

This commit is contained in:
Mausham
2025-12-29 23:31:03 +05:45
parent eadfddf220
commit 37dd15d1b9
13 changed files with 211 additions and 35 deletions

View File

@@ -0,0 +1,54 @@
using Darkmatter.Core;
using Darkmatter.Domain;
using UnityEngine;
using VContainer;
namespace Darkmatter.Presentation
{
public class GunWeapon : WeaponBase
{
[Header("VFX")]
public ParticleSystem MuzzleFlashParticle;
public ParticleSystem BulletHitEffectParticle;
[Header("Weapon Data")]
public float fireRate = 1f;
public int ammoCount = 40;
private float lastUsedTime;
public override string WeaponName => "Rifel";
public override bool canAttack => Time.time >= lastUsedTime + fireRate;
[Inject] private IAimProvider aimProvider;
public override void Attack()
{
lastUsedTime = Time.time;
ammoCount--;
PlayMuzzleFlash();
Vector3 startPos = transform.position;
Vector3 direction = aimProvider.AimDir;
Debug.Log("Attack using Gun");
//use ray cast here
//after ray cast use damage logic too
}
public override void Reload()
{
base.Reload();
ammoCount = 40;
}
private void PlayMuzzleFlash()
{
MuzzleFlashParticle.Play(true);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bf22e36737a853040b18d29e45fa59ee