refactor: 스낵 타입을 상수로 정의한다 #383
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
💻 개요
📋 변경 및 추가 사항
스낵 타입 상수화
기존 스낵 타입은
type SnackType: number로 정의되어 있어 범위가 넓었습니다.이로 인해 게임 관련 코드에
012같은 매직 넘버가 직접 사용되면서각 숫자가 어떤 스낵을 의미하는지 주변 코드를 보고 이해해야 했어용
(물론 스낵 종류가 사실상 2개라 막 되게.. 어렵진 않지만..)
스낵 타입을 상수로 정의해서 사용하는 방향으로 수정했습니다
SnackType타입도 상수 기반 유니온 타입으로 변경했습니다.SNACK_TYPE.*를 사용하도록 수정했습니다.에셋 매핑 구조 개선
기존에는
snackGameGetSnack()이 반환하는 배열을 인덱스로 해석해서 스낵 타입 - 에셋명을 매핑했습니다.게임 모드별로 사용되는 스낵 타입, 에셋 이름을 매핑한 객체를 유틸 파일에 정의했습니다.
💬 To. 리뷰어