Zabiju je
This commit is contained in:
@@ -38,17 +38,18 @@ public class FlappyBirdAllInOne : MonoBehaviour, ITask
|
||||
public (double, double) TaskLocation { get; set; }
|
||||
public bool IsCompleted { get; private set; }
|
||||
|
||||
private bool _isPaused = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
_isPaused = false;
|
||||
score = 0;
|
||||
UpdateScore();
|
||||
if (scoreText != null) UpdateScore();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (isDead) return;
|
||||
if (isDead || _isPaused) return;
|
||||
|
||||
HandleInput();
|
||||
HandleSpawning();
|
||||
@@ -99,6 +100,10 @@ public class FlappyBirdAllInOne : MonoBehaviour, ITask
|
||||
{
|
||||
score++;
|
||||
UpdateScore();
|
||||
if (score >= 10)
|
||||
{
|
||||
Complete();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateScore()
|
||||
@@ -110,14 +115,16 @@ public class FlappyBirdAllInOne : MonoBehaviour, ITask
|
||||
public void GameOver()
|
||||
{
|
||||
isDead = true;
|
||||
gameOverPanel.SetActive(true);
|
||||
Time.timeScale = 0f;
|
||||
_isPaused = true;
|
||||
if (gameOverPanel != null) gameOverPanel.SetActive(true);
|
||||
// NOTE: do NOT set Time.timeScale — GPS and network must keep running
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
// TaskManager will unload and reload via additive loading
|
||||
// Calling ExitTask lets TaskManager handle scene lifecycle
|
||||
ExitTask(_onExit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user