Exemplo n.º 1
0
    //CREATE MUSIC AREA~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public void createMusicArea()
    {
        GameObject go = new GameObject();

        go.transform.parent = transform;
        MusicArea.CreateMusicArea(go, loopLayers);
        go.transform.position = transform.position;
        go.transform.rotation = Quaternion.Euler(0, 0, 0);
    }
Exemplo n.º 2
0
    static public void CreateMusicArea(GameObject obj, LoopTrack[] other)
    {
        MusicArea ma = obj.AddComponent <MusicArea>();

        ma.loops = new LoopTrack[other.Length];
        obj.name = "Music Area " + number++;
        for (int i = 0; i < other.Length; ++i)
        {
            ma.loops[i] = new LoopTrack(other[i]);
        }
    }
Exemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        MusicArea ma = target as MusicArea;

        DrawDefaultInspector();
        if (GUILayout.Button("Play"))
        {
            ma.playAllLoops();
        }
        if (GUILayout.Button("Stop"))
        {
            ma.stopAllLoops();
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <MusicArea>() != null)
        {
            currentMusicArea = other.GetComponent <MusicArea>();
            if (!currentMusicArea.isFaderOnly)
            {
                musicManager.PlayCrossFadeMusic(currentMusicArea.musicToPlay, currentMusicArea.musicFadeInDuration, currentMusicArea.musicFadeInVolume, currentMusicArea.currentmusicTime);
            }

            if (currentMusicArea.isFadeOutCurrentMusicArea)
            {
                musicManager.FadeOutCurrentAudioTrack(currentMusicArea.musicFadeInDuration, 0f);
            }

            if (currentMusicArea.isFadeOutAllMusicAreas)
            {
                musicManager.FadeOutCurrentAudioTrack(currentMusicArea.musicFadeInDuration, 0f);
            }
        }
    }