업그레이드 데이터 입력 로직 및 기능 추가
캐릭터 스탯을 PlayerStats 컴포넌트에서 모아서 관리하도록 변경 코드에서도 마찬가지
This commit is contained in:
@@ -9,8 +9,6 @@ namespace Northbound
|
||||
public class AttackAction : NetworkBehaviour, IAction
|
||||
{
|
||||
[Header("Attack Settings")]
|
||||
public float attackRange = 2f;
|
||||
public int attackDamage = 10;
|
||||
public float attackCooldown = 0.5f;
|
||||
public LayerMask attackableLayer = ~0;
|
||||
|
||||
@@ -33,12 +31,14 @@ namespace Northbound
|
||||
private EquipmentSocket _equipmentSocket;
|
||||
private bool _isAttacking = false;
|
||||
private bool _isWeaponEquipped = false;
|
||||
private PlayerStats _playerStats;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
_teamMember = GetComponent<ITeamMember>();
|
||||
_equipmentSocket = GetComponent<EquipmentSocket>();
|
||||
_playerStats = GetComponent<PlayerStats>();
|
||||
}
|
||||
|
||||
public bool CanExecute(ulong playerId)
|
||||
@@ -80,7 +80,7 @@ namespace Northbound
|
||||
private void PerformAttack()
|
||||
{
|
||||
Vector3 attackOrigin = attackPoint != null ? attackPoint.position : transform.position;
|
||||
Collider[] hits = Physics.OverlapSphere(attackOrigin, attackRange, attackableLayer);
|
||||
Collider[] hits = Physics.OverlapSphere(attackOrigin, GetAttackRange(), attackableLayer);
|
||||
|
||||
foreach (Collider hit in hits)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace Northbound
|
||||
if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(targetNetworkId, out NetworkObject targetObj))
|
||||
{
|
||||
var damageable = targetObj.GetComponent<IDamageable>();
|
||||
damageable?.TakeDamage(attackDamage, attackerNetworkId);
|
||||
damageable?.TakeDamage(_playerStats?.GetDamage() ?? 10, attackerNetworkId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace Northbound
|
||||
{
|
||||
Vector3 attackOrigin = attackPoint != null ? attackPoint.position : transform.position;
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireSphere(attackOrigin, attackRange);
|
||||
Gizmos.DrawWireSphere(attackOrigin, GetAttackRange());
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
@@ -263,5 +263,10 @@ namespace Northbound
|
||||
}
|
||||
|
||||
public bool IsAttacking => _isAttacking;
|
||||
|
||||
/// <summary>
|
||||
/// 공격 범위 반환 (PlayerStats 우선)
|
||||
/// </summary>
|
||||
public float GetAttackRange() => _playerStats?.GetAttackRange() ?? 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user