Beispiel #1
0
    void OnTriggerEnter(Collider egg)
    {
        if (egg.tag == "White Egg")
        {
            score += 2;
            plus2.gameObject.SetActive(true);
            Invoke("Start", 1.2f);
            audioplay.PlayPlus2();
        }
        else if (egg.tag == "Rotten Egg")
        {
            score -= 3;
            minus3.gameObject.SetActive(true);
            Invoke("Start", 1.2f);
            audioplay.PlayMinus3();
        }
        else if (egg.tag == "Gold Egg")
        {
            score += 4;
            plus4.gameObject.SetActive(true);
            Invoke("Start", 1.2f);
            audioplay.PlayPlus4();
        }
        else if (egg.tag == "Blue Egg")
        {
            MoveSlow();
            isfrozen = true;
            freeze.SetActive(true);
            Invoke("Start", 1.2f);
            Invoke("reset", 5f);
            audioplay.PlayFreeze();
        }
        else if (egg.tag == "Red Egg")
        {
            Timer.plusTenSeconds();
            //Invoke("reset", 5f);
            plus10sec.SetActive(true);
            audioplay.PlayPlus10sec();
        }

        if (score < 0)
        {
            score = 0;
        }
    }