コード例 #1
0
 private void Update()
 {
     //Delay between the player dying and ending the game to allow the explosion animation to play
     if (restart)
     {
         restartTimer += Time.deltaTime;
         if (restartTimer > 0.5)
         {
             GameOver();
             restart = false;
         }
     }
     //If the new ship panel is showing then...
     if (showingNewShip)
     {
         shipTimer += Time.deltaTime;
         //If it has been showing for more than 5 seconds then stop showing it
         if (shipTimer > 5)
         {
             newShip.SetActive(false);
             showingNewShip = false;
             shipTimer      = 0;
         }
     }
     //If a new ship has been unlocked the show the new ship panel
     if (bonus.UnlockShip2(score) || bonus.UnlockShip3(score) || bonus.UnlockShip4(score))
     {
         newShip.SetActive(true);
         showingNewShip = true;
     }
 }