コード例 #1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.collider.CompareTag("ScoreCircle") && !ballHasHitScoreCircle)
     {
         ScoreManager.successfulShotsInARow++;
         ScoreManager.score   += ScoreManager.successfulShotsInARow * ScoreManager.points;
         ballHasHitScoreCircle = true;
         if (SceneManager.GetActiveScene().name == "NormalMode")
         {
             NormalModeManager.balls++;
             if (NormalModeManager.balls == 1)
             {
                 manipulationScript.ChangeShootingPosition();
             }
         }
         else
         {
             TimeModeManager.timeLeft += 5f;
         }
         comboManagerScript.ShowText();
         flamesManagerScript.EnableFlames();
     }
     else if (other.collider.CompareTag("Environment"))
     {
         if (!ballHasHitGround)
         {
             if (SceneManager.GetActiveScene().name == "NormalMode")
             {
                 if (NormalModeManager.airborneBalls > 0)
                 {
                     NormalModeManager.airborneBalls--;
                 }
             }
             else
             {
                 if (TimeModeManager.airborneBalls > 0)
                 {
                     TimeModeManager.airborneBalls--;
                 }
             }
             if (!ballHasHitScoreCircle)
             {
                 ScoreManager.successfulShotsInARow = 0;
                 flamesManagerScript.DisableFlames();
                 if ((SceneManager.GetActiveScene().name == "NormalMode" && NormalModeManager.balls == 0 && NormalModeManager.airborneBalls == 0) ||
                     (SceneManager.GetActiveScene().name == "TimeMode" && (int)TimeModeManager.timeLeft == 0 && TimeModeManager.airborneBalls == 0))
                 {
                     GameOverManager.gameOver = true;
                 }
             }
             ballHasHitGround = true;
         }
     }
 }