코드 리팩토링
재사용성 및 확장성을 고려하여 코드 전반을 리팩토링함
This commit is contained in:
@@ -7,13 +7,12 @@ public class MiningActionData : PlayerActionData
|
||||
|
||||
public override void ExecuteEffect(GameObject performer, GameObject target)
|
||||
{
|
||||
if(target == null) return;
|
||||
if (target == null) return;
|
||||
|
||||
if (target.TryGetComponent<MineableBlock>(out var block))
|
||||
// Use IDamageable interface for all damageable objects
|
||||
if (target.TryGetComponent<IDamageable>(out var damageable))
|
||||
{
|
||||
// 서버 RPC 호출은 블록 내부의 로직을 그대로 사용합니다.
|
||||
block.TakeDamageRpc(damage);
|
||||
block.PlayHitEffectClientRpc();
|
||||
damageable.TakeDamage(new DamageInfo(damage, DamageType.Mining, performer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user