public void Init(MusicManager manager, MusicBlockType type)
    {
        EngineType    = type;
        nextEventTime = AudioSettings.dspTime + 2.0f;

        string objectName = " ";

        switch (type)
        {
        case MusicBlockType.intro:
            objectName = "IntroSource";
            break;

        case MusicBlockType.normal:
            objectName = "NormalSource";
            break;

        case MusicBlockType.outro:
            objectName = "OutroSource";
            break;

        case MusicBlockType.none:
            objectName = " _ ";
            break;
        }
        for (int i = 0; i < 2; i++)
        {
            GameObject child = new GameObject(objectName);
            child.transform.parent = gameObject.transform;
            sources[i]             = child.AddComponent <AudioSource>();
            sources[i].playOnAwake = false;
        }
    }
示例#2
0
    public void StopAfterLoop(MusicBlockType type)
    {
        switch (type)
        {
        case MusicBlockType.intro:
            _introEngine.StopAfterLoop();
            break;

        case MusicBlockType.normal:
            _normalEngine.StopAfterLoop();
            break;

        case MusicBlockType.outro:
            _outroEngine.StopAfterLoop();
            break;

        case MusicBlockType.none:
            return;
        }
    }
示例#3
0
    public void GiveNewBlock(MusicBlockType engine, int index)
    {
        if (engine == MusicBlockType.none)
        {
            return;
        }
        BlockIndexes[engine] = index;
        switch (engine)
        {
        case MusicBlockType.intro:
            if (index > Track.intros.Length - 1)
            {
                return;
            }
            _introEngine.NextBlock(Track.intros[index]);
            break;

        case MusicBlockType.normal:
            if (index > Track.normals.Length - 1)
            {
                return;
            }
            _normalEngine.NextBlock(Track.normals[index]);
            break;

        case MusicBlockType.outro:
            if (index > Track.outros.Length - 1)
            {
                return;
            }
            _outroEngine.NextBlock(Track.outros[index]);
            break;

        case MusicBlockType.none:
            return;
        }
    }