출처: 골드 메탈 님의 유튜브 콘텐츠 클론 코딩



score는 Player가 가지고 있다.
-> Player Script에서 public 변수 score 선언
enemy를 처치할 때마다 Player의 score가 상승한다.
-> Enemy Script에서 health가 0이하가 될 때 player의 score를 올려주는 코드를 넣는다.
GameManager가 Player의 score를 Update하며 Text UI에 표시한다.
-> GameManager Script에서 public 변수로 UI의 Text 추가
1 2 3 4 5 | void UpdateScore() { Player playerScore = player.GetComponent<Player>(); score.text = string.Format("{0:n0}", playerScore.score); } | cs |
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 | private void OnTriggerEnter2D(Collider2D collision) { if(collision.gameObject.tag == "Border") { code } else if(collision.gameObject.tag == "EnemyBullet" || collision.gameObject.tag == "Enemy") { life--; GameManager manager = gameManager.GetComponent<GameManager>(); manager.UpdateLife(life); gameObject.SetActive(false); Destroy(collision.gameObject); if (life == 0) { manager.GameOver(); } else { manager.PlayerActiveOff(); } } } | cs |
1 2 3 4 | public void UpdateLife(int life) { lifeImage[life].color = new Color(1, 1, 1, 0); } | cs |
1 2 3 4 | public void GameOver() { gameOverSet.SetActive(true); } | cs |
1 2 3 4 | public void GameRetry() { SceneManager.LoadScene(0); } | cs |

What started as a casual session soon turned into an exhilarating rollercoaster ride. The slot machine’s bonus features activated frequently, and Sophie found herself winning small amounts consistently. Just when she thought her https://7bitcasinopokies.com/ luck might be running out, the game’s jackpot feature triggered, and she was stunned to see the jackpot amount increase rapidly. In a matter of minutes, Sophie’s modest stake had transformed into a substantial jackpot win. Her unexpected success turned an ordinary evening into a thrilling and unforgettable experience.