Notice
Recent Posts
Recent Comments
Link
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

공hannah부

CJ UNIT 7기 게임TF #5(급식실 게임 - 점수 시스템) 본문

프로젝트/CJ UNIT 7기 게임TF

CJ UNIT 7기 게임TF #5(급식실 게임 - 점수 시스템)

Hannah0226 2022. 11. 25. 01:26
오늘의 내용

- 학생을 클릭 / 드래그한 구간에 맞춰 점수를 올린다
- 콤보 시스템을 넣어 콤보 가중치를 더해준다
- 점수와 콤보를 게임 화면에 띄어준다

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);
        }

 

실행 영상