public void victory()
 {
     if (gameEnd)
     {
         return;
     }
     gameEnd = true;
     winObject.flyIn();
     enemySpawner.stop();
     Cursor.lockState = CursorLockMode.None;
 }
 public void gameOver()
 {
     if (player.hp <= 0)
     {
         if (gameEnd)
         {
             return;
         }
         gameEnd = true;
         var highScore = 0f;
         if (PlayerPrefs.HasKey(HighscoreKey))
         {
             highScore = PlayerPrefs.GetFloat(HighscoreKey);
         }
         PlayerPrefs.SetFloat(HighscoreKey, Math.Max(score, highScore));
         lostObject.flyIn();
         enemySpawner.stop();
         Cursor.lockState = CursorLockMode.None;
     }
 }