하루 만에 끝나지 않는 작업들이 생기고 하다 보니 주간 개발일지로 변경되었습니다.
1. 전투 시스템 최적화
데미지 계산 시스템 개선
public static class DamageSystem
{
private static BigInteger CalculateFinalDamage(DamageInfo damageInfo)
{
if (damageInfo.Attacker.TryGetComponent(out StatSystem attackerStats))
{
damageInfo.IsCritical = CheckCriticalHit(attackerStats);
BigInteger baseAttack = attackerStats.GetStatValue(StatType.Attack);
decimal baseDamage = (decimal)baseAttack;
decimal calculatedDamage = (decimal)DamageCalculator.Calculate(
(float)baseDamage, attackerStats, damageInfo.IsCritical);
return new BigInteger(calculatedDamage);
}
return damageInfo.BaseDamage;
}
}
- 데미지 계산 로직을 중앙 집중화하여 성능 최적화
- BigIntiger를 사용한 대규모 수치 처리 지원
- 크리티컬 및 추가 데미지 처리 개선
스탯 시스템 리팩토링
public class StatSystem : MonoBehaviour
{
private StatValue CalculateStatValue(StatType type, StatInfo stat)
{
decimal result = 0;
switch (type)
{
case StatType.CooldownReduction:
result = 50m * (1m - (decimal)Math.Exp(-0.03 * stat.currentLevel));
return new StatValue(result, 1);
case StatType.AttackSpeed:
result = 100m * (1m - (decimal)Math.Exp(-0.02 * stat.currentLevel));
return new StatValue(result, 1);
// ... 다른 스탯 계산
}
}
}
- 스탯 계산 방식 최적화
- 캐싱 시스템 도입으로 연산 최소화
- 스탯 타입별 맞춤형 계산식 적용
2. 우편함 시스템 구현
장비 수령 로직
public class UIMailSystem
{
public async Task<bool> ClaimEquipmentReward(MailData mailData)
{
if (mailData.attachedItems == null || !mailData.attachedItems.Any())
return false;
foreach (var item in mailData.attachedItems)
{
await Managers.Inventory.AddItem(item);
}
await Managers.Mail.DeleteMail(mailData.id);
return true;
}
}
- 비동기 처리
- 인벤토리 시스템과 연동
3. 이벤트 시스템 최적화
public static class EventManager
{
private static readonly Dictionary<GameEventType, HashSet<Action<object>>> eventListeners
= new Dictionary<GameEventType, HashSet<Action<object>>>();
public static void Subscribe(GameEventType eventType, Action<object> listener)
{
if (!eventListeners.ContainsKey(eventType))
eventListeners[eventType] = new HashSet<Action<object>>();
eventListeners[eventType].Add(listener);
}
}
- 이벤트 구독/해제 로직 개선
- 메모리 사용량 최적화
그 외 서버관련 처리 로직 등 개선..