공hannah부
CJ UNIT 7기 게임TF #5(급식실 게임 - 점수 시스템) 본문
오늘의 내용
- 학생을 클릭 / 드래그한 구간에 맞춰 점수를 올린다
- 콤보 시스템을 넣어 콤보 가중치를 더해준다
- 점수와 콤보를 게임 화면에 띄어준다
ComboManager
IncreaseCombo함수
- 함수 불러올 때마다 currentCombo++ 해주기
- 콤보 점수 텍스트로 띄우기 ("{0:#,##0}" 형식으로)
- 콤보가 3점일때부터 화면에 띄우기 (SetActive(true) 사용)
public void IncreaseCombo(int p_num = 1)
{
currentCombo += p_num;
txtCombo.text = string.Format("{0:#,##0}", currentCombo);
if(currentCombo > 2)
{
txtCombo.gameObject.SetActive(true);
goComboImage.SetActive(true);
}
}
Resetcobo 함수
- currentCombo, 콤보 점수 텍스트 0으로 설정, 비활성화 시키기(SetActive(false) 사용)
public void ResetCombo()
{
currentCombo = 0;
txtCombo.text = "0";
txtCombo.gameObject.SetActive(false);
goComboImage.SetActive(false);
}
ScoreManager
IncreaseScore 함수
- ComboManager에서 IncreaseCombo함수 가져오기
- 콤보 가중치 계산
- 점수 계산
- 점수 반영
public void IncreaseScore(int p_JudgementState)
{
//콤보 증가
theCombo.IncreaseCombo();
//콤보 가중치 계산
int t_currentCombo = theCombo.GetCurrentCombo();
int t_bonouseComboScore = (t_currentCombo/10) * comboBonouseScore;
//점수 계산
int t_increaseScore = increaseScore + t_bonouseComboScore;
t_increaseScore = (int)(t_increaseScore * weight[p_JudgementState]);
//점수 반영
currentScore += t_increaseScore;
txtScore.text = string.Format("{0:#,##0}", currentScore);
}
NoteO / NoteX
- 학생을 클릭 / 드래그한 구간 확인 후 ScoreManager에서 IncreaseScore함수 불러와 그 구간에 맞는 점수 올리기
//구간이 perfect일 때
if(PerfectX1 <= PositionX && PositionX <= PerfectX2)
{
theEffect.JudgementEffect(0);
theScoreManager.IncreaseScore(0); //perfect점수만큼 점수 올리기
Destroy(gameObject);
theNoteManager.ChangeStudentOHappy(PositionX);
}
- 학생을 클릭 / 드래그한 구간이 bad / miss일 경우 ComboManager에서 ResetCombo함수 가져와 콤보값 리셋해주기
//구간이 bad일 때
else if(BadX1 <= PositionX && PositionX <= BadX2)
{
theEffect.JudgementEffect(3);
theScoreManager.IncreaseScore(3); bad점수만큼 점수 올리기
theComboManager.ResetCombo(); //콤보 리셋
Destroy(gameObject);
theNoteManager.ChangeStudentOSad(PositionX);
}
실행 영상
'프로젝트 > CJ UNIT 7기 게임TF' 카테고리의 다른 글
CJ UNIT 7기 게임TF #7(급식실 게임 - 결과창) (0) | 2022.11.26 |
---|---|
CJ UNIT 7기 게임TF #6(급식실 게임 - BGM) (0) | 2022.11.25 |
CJ UNIT 7기 게임TF #4(급식실 게임 - 판정 효과) (0) | 2022.11.24 |
CJ UNIT 7기 게임TF #3(급식실 게임 - 학생 표정 바꾸기) (0) | 2022.11.23 |
CJ UNIT 7기 게임TF #2(급식실 게임 - 학생) (0) | 2022.11.23 |