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,69 @@
using System.Collections.Generic;
using UnityEngine;
public class StatusEffectReceiver : MonoBehaviour
{
private List<DebuffInstance> _activeDebuffs = new List<DebuffInstance>();
public void ApplyDebuff(DebuffData data)
{
if (data == null) return;
if (!data.Stackable)
{
DebuffInstance existing = _activeDebuffs.Find(d => d.Data == data);
if (existing != null)
{
existing.RefreshDuration();
return;
}
}
else
{
int count = 0;
foreach (var d in _activeDebuffs)
if (d.Data == data) count++;
if (count >= data.MaxStacks) return;
}
DebuffInstance instance = new DebuffInstance(data, this);
_activeDebuffs.Add(instance);
instance.OnApply();
}
private void Update()
{
for (int i = _activeDebuffs.Count - 1; i >= 0; i--)
{
_activeDebuffs[i].Tick(Time.deltaTime);
if (_activeDebuffs[i].IsExpired)
{
_activeDebuffs[i].OnRemove();
_activeDebuffs.RemoveAt(i);
}
}
}
public bool HasDebuff(DebuffType type)
{
foreach (var d in _activeDebuffs)
if (d.Data.DebuffType == type) return true;
return false;
}
public float GetDebuffValue(DebuffType type)
{
float total = 0f;
foreach (var d in _activeDebuffs)
if (d.Data.DebuffType == type) total += d.Data.Value;
return total;
}
public void ClearAllDebuffs()
{
for (int i = _activeDebuffs.Count - 1; i >= 0; i--)
_activeDebuffs[i].OnRemove();
_activeDebuffs.Clear();
}
}