Refactor character attributes system; replace individual attributes with a dictionary-based approach for better scalability and maintainability

This commit is contained in:
2025-08-02 06:06:51 +02:00
parent 93cbc4a3e5
commit 3871cba753
21 changed files with 505 additions and 417 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using Sirenix.Serialization;
namespace Data
{
[Serializable]
public class AttributeData<T>
{
[OdinSerialize]
public T Value { get; private set; }
public event Action<T> OnChanged;
public void Set(T value)
{
if (!EqualityComparer<T>.Default.Equals(Value, value))
{
Value = value;
OnChanged?.Invoke(Value);
}
}
public void Modify(Func<T, T> modifier)
{
Set(modifier(Value));
}
}
}