Esempio n. 1
0
    void Update()
    {
        if (QuitGame.decreaseSound == true)             //when quit is pressed

        {
            bgTrack01.Stop();
        }


        if (DiamondPickUp.playClip == true)             //if player wins the level decrease background music

        {
            StartCoroutine(AudioDecrease.Decrease(bgTrack01, 20.0f));
        }
    }
    void Update()
    {
        /*Audio on SignUp form*/

        if (RegisterPlayer.stopMusic == true)           //IF user hits SINGUP button



        {
            StartCoroutine(AudioDecrease.Decrease(bgTrack, 70.0f));                //it decreases slowly by NEW FACTOR



            if (SignUp.restartMusic == true)               /*If goBacktoMainMenu selected : music set back to a high volume */
            {
                StartCoroutine(AudioDecrease.Increase(bgTrack, 15.0f));
                RegisterPlayer.stopMusic = false;



                if (instance != null)
                {
                    Destroy(gameObject, 0.5F);
                    print("Destroyed ");
                }
                else
                {
                    instance = this;
                    print("created ");
                }
            }
        }
        //in any case if STARTS button is hit, the music will start decreasing
        if (SignUp.firstLevelbegins == true)
        {
            StartCoroutine(AudioDecrease.Decrease(bgTrack, 70.0f));
        }


        /*Audio on Login form*/

        /*when user hits LOGIN (login scene) the first music background stops*/
        if (AuthenticatePlayer.changeAudio == true)
        {
            StartCoroutine(AudioDecrease.Decrease(bgTrack, 70.0f));
        }
    }
Esempio n. 3
0
    void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject, 0.5F);
            print("Destroyed ");
        }
        else
        {
            instance = this;
            print("created ");
        }



        GameObject.DontDestroyOnLoad(gameObject);           /*THE TRACK WILL STILL BE PLAYING ONCE WE CHANGE THE SCENE*/
        StartCoroutine(AudioDecrease.Increase(bgTrack01, 10.0f));
    }
    // Update is called once per frame
    void Update()
    {
        if (DiamondPickUp.playClip == true)
        {
            audioTrack.PlayOneShot(shot, 1.9F);
            print("Effect no.2 done well ");

            if (count == 17)               //handling clip time on pick up key action


            {
                StartCoroutine(AudioDecrease.Decrease(audioTrack, 70.0f));                   //it decreases slowly from 1 to that NEW FACTOR
                print("Current Volume: " + audioTrack.volume);
                DiamondPickUp.playClip = false;
            }

            count++;
        }
    }