// Start is called before the first frame update
    void Start()
    {
        button    = GetComponent <Button>();
        mainMusic = FindObjectOfType <MainMusic>();
        image     = GetComponent <Image>();

        musicPlaying = mainMusic.isPlaying(mainMusic.nowPlaying);
        //Debug.Log(musicPlaying);

        image.sprite = musicPlaying ? pause : resume;
    }
Exemplo n.º 2
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
     //musicSource = GetComponent<AudioSource>();
 }
Exemplo n.º 3
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 4
0
    private void Awake()
    {
        if (_instance && _instance != this)
        {
            Debug.LogWarning("Music was already found on the scene, I will self-destruct, bye!", this);
            Destroy(gameObject);
            return;
        }

        _instance = this;
        DontDestroyOnLoad(this.gameObject);
    }
Exemplo n.º 5
0
    private void Awake()
    {
        DontDestroyOnLoad(gameObject);
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        _audioSource = GetComponent <AudioSource>();
    }
Exemplo n.º 6
0
    void Awake()
    {
        if (!_instance)
        {
            _instance = this;
        }
        else if (this.gameObject.GetComponent <AudioSource>().clip != _instance.gameObject.GetComponent <AudioSource>().clip)
        {
            Destroy(_instance.gameObject);
            _instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(this.gameObject);
    }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        rigid       = GetComponent <Rigidbody2D>();
        scoreUIP1   = GameObject.Find("Score P1").GetComponent <Text> ();
        scoreUIP2   = GameObject.Find("Score P2").GetComponent <Text> ();
        tutorial    = GameObject.Find("Tutorial").GetComponent <Text> ();
        MediaPlayer = gameObject.GetComponent <AudioSource>();
        ResetBall();

        GameObject go = GameObject.FindGameObjectWithTag("MainMusic");

        if (go != null)
        {
            mainMusic = go.GetComponent <MainMusic>();
        }
        if (mainMusic != null)
        {
            mainMusic.PlayMusic();
        }
    }
Exemplo n.º 8
0
 void Start()
 {
     _Main = FindObjectOfType <MainMusic>();
 }
 private void Awake()
 {
     instance = this;
 }