Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        GameObject  music      = GameObject.Find("music");
        musicScript callchange = (musicScript)music.GetComponent(typeof(musicScript));

        if (musicNumber == 1)
        {
            callchange.playMultiplayer();
        }
        else if (musicNumber == 2)
        {
            callchange.playSciFi();
        }
        else if (musicNumber == 3)
        {
            callchange.playGangster();
        }
        else if (musicNumber == 4)
        {
            callchange.playWestern();
        }
        else if (musicNumber == 5)
        {
            callchange.playMain();
        }
    }
Ejemplo n.º 2
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
        }

        if (PlayerPrefs.GetInt("MusicInput") == 0)
        {
            PlayerPrefs.SetInt("MusicInput", 1);
        }

        if ((PlayerPrefs.GetInt("MusicInput") == 1))
        {
            DontDestroyOnLoad(this.gameObject);
        }
        else if ((PlayerPrefs.GetInt("MusicInput") == 2))
        {
            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 3
0
 private void Awake()
 {
     if (singleton)
     {
         Destroy(gameObject);
     }
     else
     {
         singleton = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
Ejemplo n.º 4
0
 void Start()
 {
     _musicScript = mySource.GetComponent <musicScript> ();
     _randomColor = new Color((float)Random.Range(0, colorPrecision) / (float)colorPrecision, (float)Random.Range(0, colorPrecision) / (float)colorPrecision, (float)Random.Range(0, colorPrecision) / (float)colorPrecision, 1.0f);
     _myParticles = this.GetComponent <ParticleSystem> ();
 }