2026-04-08 스킬시스템 진행중, 폴더구조 변경등

This commit is contained in:
2026-04-08 05:36:01 +09:00
parent 0844a07902
commit 4eca51b885
1334 changed files with 61947 additions and 14859 deletions

View File

@@ -0,0 +1,61 @@
using UnityEngine;
public class ZoneEntity : MonoBehaviour
{
private float _damage;
private float _radius;
private float _duration;
private float _tickInterval;
private DebuffData[] _debuffs;
private float _lifeTimer;
private float _tickAccumulator;
public void Init(float damage, float radius, float duration, float tickInterval, DebuffData[] debuffs)
{
_damage = damage;
_radius = radius;
_duration = duration;
_tickInterval = tickInterval > 0 ? tickInterval : 1f;
_debuffs = debuffs;
}
private void Update()
{
_lifeTimer += Time.deltaTime;
_tickAccumulator += Time.deltaTime;
if (_tickAccumulator >= _tickInterval)
{
_tickAccumulator -= _tickInterval;
ApplyTickDamage();
}
if (_lifeTimer >= _duration)
{
Destroy(gameObject);
}
}
private void ApplyTickDamage()
{
Collider[] hits = Physics.OverlapSphere(transform.position, _radius);
foreach (Collider col in hits)
{
IDamageable target = col.GetComponent<IDamageable>();
if (target == null) continue;
target.TakeDamage(Mathf.RoundToInt(_damage), transform);
if (_debuffs != null)
{
StatusEffectReceiver receiver = col.GetComponent<StatusEffectReceiver>();
if (receiver != null)
{
foreach (var debuff in _debuffs)
receiver.ApplyDebuff(debuff);
}
}
}
}
}