Esempio n. 1
0
    private void CheckBusted()
    {
        GameObject nearestPolice      = GetNearestPoliceVehicle();
        float      normalizedVelocity = Mathf.Abs(playerRB.velocity.magnitude);

        if (nearestPolice == null)
        {
            bustedAmount = 0;
        }
        else
        {
            if (normalizedVelocity < minVelocityThreshold)
            {
                bustedAmount += 1;
            }
            else
            {
                bustedAmount -= 1;
            }
        }

        bustedAmount = bustedAmount < 0 ? 0 : bustedAmount;

        if (bustedAmount >= maxBustedAmount)
        {
            bustedTextHolder.SetTrigger(AnimatorVariables.FadeIn);

            targetClosestPolice.StopShooting();
            playerCarController.disableDefaultControl = true;

            bustedSet = true;
            increaseScoreController.SendScoreToSceneTrigger(true);
        }
    }
 private new void CheckHealthZero()
 {
     if (base.currentCarHealth <= 0)
     {
         increaseScoreController.SendScoreToSceneTrigger(false);
         Destroy(directionArrow);
         base.CheckHealthZero();
     }
 }