private void OnCollisionEnter(Collision collision)
    {
        if ((collision.collider.CompareTag("Car") && driveGameManager.getSpeed() >= 20f) ||
            (collision.collider.CompareTag("CarRear") && driveGameManager.getSpeed() <= -20f))
        {
            Vector3 spawnPosHead = new Vector3(gameObject.transform.position.x, 1, gameObject.transform.position.z);
            Vector3 spawnPosBody = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
            Instantiate(zombieHead, spawnPosHead, gameObject.transform.rotation);
            Instantiate(zombieBody, spawnPosBody, gameObject.transform.rotation);
            Destroy(gameObject);
        }
        if (collision.collider.CompareTag("CarVulnerable") && driveGameManager.getSpeed() < 20)
        {
            if (canDamagePlayer)
            {
                PlayerPrefs.SetFloat("Health", PlayerPrefs.GetFloat("Health") - 7f);
                if (PlayerPrefs.GetFloat("Health") < 0)
                {
                    PlayerPrefs.SetFloat("Health", 0);
                }
                currentDamageToPlayer += 7;
            }

            if (currentDamageToPlayer >= 30)
            {
                canDamagePlayer = false;
            }
        }
    }
 private void OnCollisionEnter(Collision collision)
 {
     Debug.Log("Here");
     if (collision.gameObject.CompareTag("Zombie"))
     {
         if (Math.Abs(gameManager.getSpeed()) < 15)
         {
             PlayerPrefs.SetFloat("Health", PlayerPrefs.GetFloat("Health") - 10f);
             Debug.Log(PlayerPrefs.GetFloat("Health"));
         }
     }
 }
    // Update is called once per frame
    void FixedUpdate()
    {
        horizontalInput = Input.GetAxis("Horizontal");
        verticalInput   = Input.GetAxis("Vertical");

        // Gas is on.  Move forwards
        if (verticalInput > 0)
        {
            if (gameManager.getSpeed() < maxSpeed)
            {
                if (gameManager.getSpeed() < 0)
                {
                    gameManager.incrementSpeed(2);
                }
                gameManager.incrementSpeed(0.6f);
            }

            else
            {
                gameManager.setSpeed(maxSpeed);
            }
        }
        // Reverse is on.  Move backwards
        else if (verticalInput < 0)
        {
            if (gameManager.getSpeed() > -maxSpeed)
            {
                if (gameManager.getSpeed() > 0)
                {
                    gameManager.decrementSpeed(2);
                }
                gameManager.decrementSpeed(0.6f);
            }
            if (gameManager.getSpeed() < -maxSpeed)
            {
                gameManager.setSpeed(-maxSpeed);
            }
        }
        // Car is not getting gas.  Slow down
        else if (verticalInput == 0)
        {
            // Car is moving forwards
            if (gameManager.getSpeed() > 0)
            {
                gameManager.decrementSpeed(1.0f);

                if (gameManager.getSpeed() < 0)
                {
                    gameManager.setSpeed(0);
                }
            }
            // Car is moving backwards
            else if (gameManager.getSpeed() < 0)
            {
                gameManager.incrementSpeed(1.0f);

                if (gameManager.getSpeed() > 0)
                {
                    gameManager.setSpeed(0);
                }
            }
        }

        transform.Translate(Vector3.forward * gameManager.getSpeed() * Time.deltaTime);

        if (gameManager.getSpeed() > 0)
        {
            transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime * horizontalInput);
        }
        else if (gameManager.getSpeed() < 0)
        {
            transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime * -horizontalInput);
        }

        if (isTouchingObstacle)
        {
            if (gameManager.getSpeed() > 0)
            {
                gameManager.decrementSpeed(1.5f);
                if (gameManager.getSpeed() < 0)
                {
                    gameManager.setSpeed(0);
                }
            }
            if (gameManager.getSpeed() < 0)
            {
                gameManager.incrementSpeed(1.5f);
                if (gameManager.getSpeed() > 0)
                {
                    gameManager.setSpeed(0);
                }
            }
        }

        if (scene == 7)
        {
            if (gameObject.transform.position.y < 2.0f)
            {
                PlayerPrefs.SetFloat("Health", 0);
            }
        }
    }