diff --git a/Movement/BirdJump.cs b/Movement/BirdJump.cs index 96c9dfd..48be415 100644 --- a/Movement/BirdJump.cs +++ b/Movement/BirdJump.cs @@ -1,6 +1,7 @@ using System.Collections; //python의 import == using using System.Collections.Generic; using UnityEngine; +using UnityEngine.SceneManagement; public class BirdJump : MonoBehaviour { @@ -18,8 +19,16 @@ void Update() { if(Input.GetMouseButtonDown(0)) { + GetComponent().Play(); // 점프할 때마다 소리 출력 rb.velocity = Vector2.up * jumpPower; //(0,1)*3, Vector3면 3차원(x,y,z), 3만큼 힘을 받아서 점프 } } + + private void OnCollisionEnter2D(Collision2D other) { //물체가 서로 부딪혔을 때 {}안의 내용을 실행 + if(Score.score > Score.bestScore){ + Score.bestScore = Score.score; + } + SceneManager.LoadScene("GameOverScene"); // 새가 물체에 부딪혀서 GameOverScene으로 전환 + } }