[Update] 휴대폰 조이스틱 연결 및 스크립트 변경
1. 휴대폰에서 실시가능하도록 조이스틱 및 버튼 입력 2. 콜라이더 및 트리거 구조 변경 3. 로테이션 단계이상함 감지 - 수정 예정
This commit is contained in:
@@ -13,10 +13,13 @@ public class GameManager : MonoBehaviour
|
||||
private float surviveTime;
|
||||
private bool isGameover;
|
||||
|
||||
public GameObject restartButton;
|
||||
|
||||
public void EndGame()
|
||||
{
|
||||
isGameover = true;
|
||||
gameoverText.SetActive(true);
|
||||
restartButton.SetActive(true);
|
||||
|
||||
float bestTime = PlayerPrefs.GetFloat("BestTime");
|
||||
if(surviveTime > bestTime)
|
||||
@@ -26,6 +29,7 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
|
||||
recordText.text = "Best Time: " + (int)bestTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +50,15 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.R))
|
||||
// 1. PC: R키
|
||||
if (Input.GetKeyDown(KeyCode.R))
|
||||
{
|
||||
SceneManager.LoadScene("Game");
|
||||
RestartGame();
|
||||
}
|
||||
// 2. 모바일/PC: 클릭 또는 터치 (화면 아무데나 눌러도 재시작)
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
RestartGame();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +68,9 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
return surviveTime;
|
||||
}
|
||||
|
||||
public void RestartGame()
|
||||
{
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user