Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Ball")
        {
            //Plays bumper collision sound
            audioSource.PlayOneShot(clip, volume);
            audioSource.PlayOneShot(clip2, volume);


            //Changes sprite on collision
            //GetComponent<SpriteRenderer>().sprite = spriteSet[1];
            //Adds points to score
            GameMaster.BumperHit(this);
            if (!isOn)
            {
                isOn = true;
                if (isSection)
                {
                    GameObject.Find("LevelMaster").GetComponent <LevelMaster>().randPowerUp();
                    GameMaster.sectionButtonOn();
                }
            }
            else if (isOn)
            {
                isOn = false;
                if (isSection)
                {
                    GameMaster.sectionButtonOff();
                }
            }
        }
    }