protected LugusAudioChannel CreateChannel(Lugus.AudioChannelType type)
    {
        LugusAudioChannel channel = new LugusAudioChannel(type);

        _channels.Add(channel);

        return(channel);
    }
    public LugusAudioChannel Speech()
    {
        if (speech == null)
        {
            speech = GetChannel(Lugus.AudioChannelType.ForegroundSpeech);
        }

        return(speech);
    }
    public LugusAudioChannel SFX()
    {
        if (sfx == null)
        {
            sfx = GetChannel(Lugus.AudioChannelType.ForegroundSFX);
        }

        return(sfx);
    }
    public LugusAudioChannel Ambient()
    {
        if (ambient == null)
        {
            ambient = GetChannel(Lugus.AudioChannelType.BackgroundAmbient);
        }

        return(ambient);
    }
    public LugusAudioChannel Music()
    {
        if (music == null)
        {
            music = GetChannel(Lugus.AudioChannelType.BackgroundMusic);
        }

        return(music);
    }
    public LugusAudioChannel Custom3()
    {
        if (custom3 == null)
        {
            custom3 = GetChannel(Lugus.AudioChannelType.Custom3);
        }

        return(custom3);
    }
    public void Play()
    {
        if (clip == null)
        {
            FetchClip();             // here it's really needed, so no check for preload there
        }

        if (clip == null)
        {
            Debug.LogError(name + " : audioClip " + key + " not found");
            return;
        }

        LugusAudioChannel channel = LugusAudio.use.GetChannel(channelType);

        // TODO: best cache the GetAudio result and only re-fetch (and re-cache) when we receive callback from LugusResources)
        channel.Play(clip, this.stopOthers, new LugusAudioTrackSettings().Loop(this.loop));
    }
    public LugusAudioChannel GetChannel(Lugus.AudioChannelType type)
    {
        LugusAudioChannel output = null;

        foreach (LugusAudioChannel channel in _channels)
        {
            if (channel.ChannelType == type)
            {
                output = channel;
                break;
            }
        }

        if (output == null)
        {
            output = CreateChannel(type);
        }

        return(output);
    }
예제 #9
0
    protected LugusAudioChannel CreateChannel(Lugus.AudioChannelType type)
    {
        LugusAudioChannel channel = new LugusAudioChannel( type );

        _channels.Add( channel );

        return channel;
    }
예제 #10
0
 public void PlaySound(LugusAudioChannel channel, AudioClip sound)
 {
     channel.Play(sound);
 }