DEG-15 [Fix] 소수점 오류 처리

This commit is contained in:
Sehyeon 2025-04-18 13:21:10 +09:00
parent 5420028b34
commit ca8d769ab8
3 changed files with 6 additions and 8 deletions

View File

@ -35,10 +35,7 @@ public class GameConstants
// 기상 시간
public float wakeUpTime = 8.0f;
// 오전 8시 기상 값
public float wakeUpAtEight = 888f;
// 강제 값 (탈진, 결근-늦잠)
// 수면 이벤트 강제 값
public float forcedValue = 999f;
// 날짜 한계 값

View File

@ -73,7 +73,7 @@ public class PlayerStats : MonoBehaviour
bool isDayEnded = false;
// 수면 행동 처리
if (actionType == ActionType.Sleep) // 다음 날 오전 8시 기상
if (actionType == ActionType.Sleep || actionType == ActionType.TeamDinner) // 다음 날 오전 8시 기상
{
// 다음 날 오전 8시 - 현재 시간 값
float nowTime = TimeStat - time;
@ -178,7 +178,8 @@ public class PlayerStats : MonoBehaviour
public void ModifyReputation(float reputation)
{
ReputationStat += reputation;
// float 연산 시 계산 오차가 발생할 수도 있기에 소수점 두 번째에서 반올림하도록 처리
ReputationStat = Mathf.Round((ReputationStat + reputation) * 100f) / 100f;
if (ReputationStat <= 0)
{

View File

@ -33,7 +33,7 @@ public class ValueByAction
actionEffects = new Dictionary<ActionType, ActionEffect>
{
// 기본 액션들, 효과(시간, 체력, 평판 순)
{ ActionType.Sleep, new ActionEffect(_gameConstants.wakeUpAtEight, 0, 0) }, // 8시 강제 기상
{ ActionType.Sleep, new ActionEffect(_gameConstants.forcedValue, 0, 0) }, // 8시 강제 기상
{ ActionType.OverSlept, new ActionEffect(_gameConstants.forcedValue, 0, 0) }, // 결근 (오후 3~6시 기상)
{ ActionType.ForcedSleep, new ActionEffect(_gameConstants.forcedValue, 4, 0) }, // 탈진
{ ActionType.Eat, new ActionEffect(+1.0f, +1.0f, 0) },
@ -41,7 +41,7 @@ public class ValueByAction
{ ActionType.Dungeon, new ActionEffect(+3.0f, -3.0f, 0) },
{ ActionType.Housework, new ActionEffect(+1.0f, -1.0f, +0.2f) },
{ ActionType.OvertimeWork, new ActionEffect(+4.0f, -5.0f, +1.0f) },
{ ActionType.TeamDinner, new ActionEffect(_gameConstants.wakeUpAtEight, _gameConstants.forcedValue, 0) }, // 수면 강제(8시 기상) 후 최대 체력
{ ActionType.TeamDinner, new ActionEffect(_gameConstants.forcedValue, _gameConstants.forcedValue, 0) }, // 수면 강제(8시 기상) 후 최대 체력
{ ActionType.Absence, new ActionEffect(0, 0, -3.0f) }
};
}