Exemplo n.º 1
0
    void Awake()
    {
        if (GameObject.FindGameObjectsWithTag("SoundManager").Length >= 2)
        {
            Destroy(gameObject);
            return;
        }
        curveRate   = 0.0f;
        nowVolume   = 1.0f;
        updateCurve = null;
        DontDestroyOnLoad(this.gameObject);
        feed_inCurve  = feed_inCurveSetting;
        feed_outCurve = feed_outCurveSetting;

        //Dictionaryに追加する
        bgmDictionary = new Dictionary <BGM_NAME, BGMs>();
        for (int i = 0; i < bgmParameter.Length; i++)
        {
            bgmDictionary [bgmParameter [i].bgmName] = bgmParameter [i];
        }

        seDictionary = new Dictionary <SE_NAME, SEs>();
        for (int i = 0; i < seParameter.Length; i++)
        {
            seDictionary [seParameter [i].seName] = seParameter [i];
        }
        gameObject.AddComponent <AudioSource> ();
        myObj      = gameObject;
        nowBgmEnum = BGM_NAME.TITLE;
        SetVolume(1.0f);
    }
Exemplo n.º 2
0
    //BGMを再生する
    public static void PlayBGM(BGM_NAME bgmEnum)
    {
        nowBgmEnum = bgmEnum;
        AudioSource audio = myObj.GetComponent <AudioSource>();
        BGMs        bgm   = bgmDictionary[bgmEnum];

        audio.Stop();
        audio.clip   = bgm.clip;
        audio.loop   = true;
        audio.volume = nowVolume * bgm.volume;
        audio.Play();
    }
Exemplo n.º 3
0
    public static void Fade_inPlay(BGM_NAME bgmEnum, float frame)
    {
        nowBgmEnum = bgmEnum;
        BGMs bgms = bgmDictionary[bgmEnum];

        myObj.GetComponent <AudioSource>().clip = bgms.clip;
        myObj.GetComponent <AudioSource>().Play();
        updateCurve = feed_inCurve;
        beginVolume = 0.0f;
        endVolume   = nowVolume * bgmDictionary[nowBgmEnum].volume;
        myObj.GetComponent <SoundManager>().frame = frame;
    }
Exemplo n.º 4
0
	void Awake () {
		if (GameObject.FindGameObjectsWithTag ("SoundManager").Length >= 2) {
			Destroy (gameObject);
			return;
		}
		curveRate = 0.0f;
		nowVolume = 1.0f;
		updateCurve = null;
		DontDestroyOnLoad (this.gameObject);
		feed_inCurve = feed_inCurveSetting;
		feed_outCurve = feed_outCurveSetting;

		//Dictionaryに追加する
		bgmDictionary = new Dictionary<BGM_NAME, BGMs>();
		for (int i = 0; i < bgmParameter.Length; i++) {
			bgmDictionary [bgmParameter [i].bgmName] = bgmParameter [i];
		}

		seDictionary = new Dictionary<SE_NAME, SEs>();
		for (int i = 0; i < seParameter.Length; i++) {
			seDictionary [seParameter [i].seName] = seParameter [i];
		}
		gameObject.AddComponent<AudioSource> ();
		myObj = gameObject;
		nowBgmEnum = BGM_NAME.TITLE;
		SetVolume (1.0f);
	}
Exemplo n.º 5
0
	//BGMを再生する
	public static void PlayBGM(BGM_NAME bgmEnum) {
		nowBgmEnum = bgmEnum;
		AudioSource audio = myObj.GetComponent<AudioSource>();
		BGMs bgm = bgmDictionary[bgmEnum];
		audio.Stop();
		audio.clip = bgm.clip;
		audio.loop = true;
		audio.volume = nowVolume*bgm.volume;
		audio.Play();
	}
Exemplo n.º 6
0
	public static void Fade_inPlay(BGM_NAME bgmEnum,float frame) {
		nowBgmEnum = bgmEnum;
		BGMs bgms = bgmDictionary[bgmEnum];
		myObj.GetComponent<AudioSource>().clip = bgms.clip;
		myObj.GetComponent<AudioSource>().Play();
		updateCurve = feed_inCurve;
		beginVolume = 0.0f;
		endVolume = nowVolume * bgmDictionary[nowBgmEnum].volume;
		myObj.GetComponent<SoundManager>().frame = frame;
	}