Exemplo n.º 1
0
    void OnTriggerEnter()
    {
        // Dodaj czas oraz odegraj dzwiek
        GameObject timeText = GameObject.Find("timeText");

        timeText.GetComponent <TimeCounter>().elapsedTime += 4.0f;
        if (!GameGUI.Mute())
        {
            audio.Play();
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.CompareTag("Player") && this.enabled)
        {
            // Zdobyles gwiazdke - odjecie czasu, odegranie dzwieku i schowanie gwiazdki

            GameObject  timeText = GameObject.Find("timeText");
            TimeCounter counter  = timeText.GetComponent <TimeCounter>();
            counter.elapsedTime -= 2.0f;
            if (counter.elapsedTime < 0)
            {
                counter.elapsedTime = 0;
            }

            if (!GameGUI.Mute())
            {
                audio.Play();
            }

            renderer.enabled = false;
            this.enabled     = false;
        }
    }