Beispiel #1
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "FoodDestroyer")
        {
            soundsManager.PlayLoseEatSound();
            gameManager.currentMissedFood++;
            Destroy(this.gameObject);
        }

        else if (col.gameObject.tag == "Hero" && playerController.currentFoodType == foodType)
        {
            soundsManager.PlayEatSound();
            playerController.StartCoroutine("EatingAnimation");
            gameManager.currentScore++;
            Destroy(this.gameObject);
        }

        else if (col.gameObject.tag == "Hero" && playerController.currentFoodType != foodType)
        {
            gameManager.currentMissedFood++;
            Destroy(this.gameObject);
        }
    }