Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    void Awake()
    {
        GameObject      go    = GameObject.Find("SoundManager");
        backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic));

        tone = other.getTone();
    }
Ejemplo n.º 2
0
    void Start()
    {
        GameObject      go    = GameObject.Find("SoundManager");
        backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic));

        highscore = other.highscore;
    }
Ejemplo n.º 3
0
    public void Dead()
    {
        GameObject      go    = GameObject.Find("SoundManager");
        backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic));
        bool            tone  = other.getTone();

        if (tone == true)
        {
            source.PlayOneShot(die);
        }
    }
 // Awake is called when backgroundMusic is created
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Ejemplo n.º 5
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            return;
        }
        else
        {
            instance = this;
        }

        //Keep the song playing
        DontDestroyOnLoad(this.gameObject);
    }
Ejemplo n.º 6
0
    public void BirdDied()
    {
        if (score > highscore)
        {
            GameObject      go    = GameObject.Find("SoundManager");
            backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic));
            highscore = score;
            other.setScore(score);
        }
        HighText.text = "High Score : " + highscore.ToString();
        SkorText.text = "Score : " + score.ToString();
        GameOverCanvas.SetActive(true);

        gameOver = true;
    }
Ejemplo n.º 7
0
    void Update()
    {
        GameObject      go    = GameObject.Find("SoundManager");
        backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic));

        Image image = toggle.targetGraphic as Image;

        if (toggle.isOn)
        {
            other.setTone(true);
            image.overrideSprite = bg1;
        }
        else
        {
            other.setTone(false);
            image.overrideSprite = bg2;
        }
    }
Ejemplo n.º 8
0
    void Sound()
    {
        GameObject      go    = GameObject.Find("SoundManager");
        backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic));

        Image image = toggle.targetGraphic as Image;

        if (toggle.isOn)
        {
            other.setActive(true);
            image.overrideSprite = bg1;
            other.StartAudio();
        }
        else
        {
            other.setActive(false);
            image.overrideSprite = bg2;
            other.PauseAudio();
        }
    }
Ejemplo n.º 9
0
 public void ChangeSong(int number)
 {
     music = GameObject.FindWithTag("Music").GetComponent <backgroundMusic>();
     music.SetChoice(number);
 }