started building logics for enemy

This commit is contained in:
Mausham
2025-12-30 22:51:33 +05:45
parent b59d12631f
commit 3aabc42bf8
76 changed files with 9832 additions and 82084 deletions

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 156c6779124556c48b177104c19c29f9
guid: d918fdc659ee8fe4e8c97089cf4bc09b
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,21 @@
using UnityEngine;
using VContainer;
using VContainer.Unity;
namespace Darkmatter.Domain
{
public class EnemyController : IStartable, ITickable
{
[Inject] EnemyStateMachine esm;
public void Start()
{
}
public void Tick()
{
esm.Update();
}
}
}

View File

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

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace Darkmatter.Domain
{
public class EnemyStateMachine:StateMachine
{
}
}

View File

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

View File

@@ -13,7 +13,7 @@ namespace Darkmatter.Domain
[Inject] public readonly IPlayerAnim playerAnim;
[Inject] public readonly ITargetProvider targetProvider;
[Inject] public readonly ICameraService cameraService;
[Inject] public readonly IWeapon GunWeapon;
[Inject] public readonly IReloadableWeapon currentWeapon;
[Inject] public readonly PlayerConfigSO playerConfig;
[Inject] public readonly CameraConfigSO cameraConfig;
@@ -54,23 +54,23 @@ namespace Darkmatter.Domain
public void Shoot(bool isShooting)
{
if (!isShooting) return;
if(GunWeapon.canAttack)
if(currentWeapon.canAttack)
{
GunWeapon.Attack();
currentWeapon.Attack();
}
if(GunWeapon.AmmoCount==0)
if (currentWeapon.AmmoCount == 0)
{
playerAnim.PlayReloadAnim(GunWeapon);
playerAnim.PlayReloadAnim(currentWeapon);
}
}
public void Reload()
{
if(GunWeapon.AmmoCount < GunWeapon.maxAmmoCount)
if(currentWeapon.AmmoCount<currentWeapon.initialAmmoCount)
{
playerAnim.PlayReloadAnim(GunWeapon);
playerAnim.PlayReloadAnim(currentWeapon);
}
}
}

View File

@@ -1,23 +0,0 @@
using Darkmatter.Core;
using UnityEngine;
namespace Darkmatter.Domain
{
public abstract class WeaponBase : MonoBehaviour, IWeapon
{
public abstract bool canAttack { get; }
public abstract string WeaponName {get; }
public virtual int AmmoCount { get; set; }
public int maxAmmoCount { get; private set; } = 40;
public abstract void Attack();
public virtual void Reload()
{
Debug.Log("Reloading");
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 87a4d2aa64c2bc1468b8e548d66764e1