Update layers for GameObjects and add EnemyDeathBehavior class

This commit is contained in:
2025-07-11 22:23:42 +02:00
parent 355add5a33
commit 7640c59e43
5 changed files with 262 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
using Interfaces;
using UnityEngine;
namespace Systems
{
public class EnemyDeathBehavior : MonoBehaviour, IDeathBehavior
{
public void Die()
{
Destroy(gameObject);
// later let's add particle effects, sound effects, etc.
// and give player experience points
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 73900af7351645fdb19d016d621feb35
timeCreated: 1752264813

View File

@@ -20,8 +20,14 @@ namespace Weapons
if (hit.gameObject == character.gameObject) continue;
var damage = GetFinalDamage();
health.TakeDamage(damage);
health?.TakeDamage(damage);
}
}
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, GetFinalRange());
}
}
}

View File

@@ -11,7 +11,6 @@ namespace Weapons
{
private float timer;
[SerializeField] private float cooldown = 1f;
[SerializeField] protected Character character;
[OdinSerialize, InlineProperty] public WeaponStats weaponStats = new();