Beispiel #1
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        if (instance != this)
        {
            DestroyImmediate(this);
        }
        timer = 0;
        //DontDestroyOnLoad(this);

        inst_GenerateNote = GenerateNote.GetInstance();
        BGSound           = GetComponent <AudioSource>();
        isBGSoundMute     = PlayerPrefs.GetInt(BGKeyString, dontMute);
        if (isBGSoundMute == mute)
        {
            BGSound.mute    = true;
            imgMainBGSound  = imgMainBGSounds[0];
            imgPauseBGSound = imgPauseBGSounds[0];
        }
        else if (isBGSoundMute == dontMute)
        {
            BGSound.mute    = false;
            imgMainBGSound  = imgMainBGSounds[1];
            imgPauseBGSound = imgPauseBGSounds[1];
        }
        else
        {
            Debug.LogError("wrong mute number");
        }

        isFXSoundMute = PlayerPrefs.GetInt(FXKeyString, dontMute);
        if (isFXSoundMute == mute)
        {
            for (int i = 0; i < FXSounds.Length; i++)
            {
                FXSounds[i].mute = true;
            }
            imgMainFXSound  = imgMainFXSounds[0];
            imgPauseFXSound = imgPauseFXSounds[0];
        }
        else if (isFXSoundMute == dontMute)
        {
            for (int i = 0; i < FXSounds.Length; i++)
            {
                FXSounds[i].mute = false;
            }
            imgMainFXSound  = imgMainFXSounds[1];
            imgPauseFXSound = imgPauseFXSounds[1];
        }
        else
        {
            Debug.LogError("wrong mute number");
        }
    }
Beispiel #2
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        if (instance != this)
        {
            DestroyImmediate(this);
        }

        playerZPos = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>().position.z;
    }
Beispiel #3
0
 private void Awake()
 {
     inst_GenerateNote = GetComponent <GenerateNote>();
     path = Resources.Load("notes", typeof(TextAsset)) as TextAsset;
     ReadLines();
 }