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

@@ -4,6 +4,7 @@ using Interfaces;
using Sirenix.OdinInspector;
using Sirenix.Serialization;
using UnityEngine;
using Attribute = Data.Attribute;
namespace Weapons
{
@@ -27,18 +28,18 @@ namespace Weapons
private float GetFinalAttackSpeed()
{
return character.attributes.AttackSpeed * weaponStats.attackSpeed;
return character.attributes.Get(Attribute.AttackSpeed) * weaponStats.attackSpeed;
}
protected float GetFinalDamage()
{
return weaponStats.damage + character.attributes.Damage *
(weaponStats.damageType == DamageType.Melee ? character.attributes.MeleeDamage : character.attributes.RangedDamage);
return weaponStats.damage + character.attributes.Get(Attribute.Damage) *
(weaponStats.damageType == DamageType.Melee ? character.attributes.Get(Attribute.MeleeDamage) : character.attributes.Get(Attribute.RangedDamage));
}
protected float GetFinalRange()
{
return weaponStats.range * character.attributes.AttackRange;
return weaponStats.range * character.attributes.Get(Attribute.AttackRange);
}
protected void PlayShotSound()