Exemplo n.º 1
0
        public void SetPitch(AudioHandle handle, float pitch)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                sourceInfo.Source.pitch = pitch;
            }
        }
Exemplo n.º 2
0
        public string GetClipId(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo (handle);
            if (sourceInfo != null) {
                return sourceInfo.ClipId;
            }

            return string.Empty;
        }
Exemplo n.º 3
0
        public bool IsPlaying(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                return(sourceInfo.Source.isPlaying);
            }

            return(false);
        }
Exemplo n.º 4
0
        public string GetClipId(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                return(sourceInfo.ClipId);
            }

            return(string.Empty);
        }
Exemplo n.º 5
0
        public float GetVolume(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                return(sourceInfo.Source.volume);
            }

            return(0.0f);
        }
Exemplo n.º 6
0
        public float GetPitch(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                return(sourceInfo.Source.pitch);
            }

            return(1.0f);
        }
Exemplo n.º 7
0
        private AudioSourceInfo GetSourceInfo(AudioHandle handle)
        {
            if (handle.Id != AudioHandle.INVALID_ID)
            {
                AudioSourceInfo sourceInfo = _sourceInfos [handle.Index];

                // Verify handle integrity.
                if (sourceInfo.HandleId == handle.Id)
                {
                    return(sourceInfo);
                }
            }

            return(null);
        }
Exemplo n.º 8
0
        public void Stop(AudioHandle handle, float fadeOutTime)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                if (fadeOutTime > 0.0f &&
                    !_isMuted)
                {
                    sourceInfo.VolumeFluctuationSpeed = -sourceInfo.Source.volume / fadeOutTime;
                    sourceInfo.TargetVolume           = 0.0f;
                }
                else
                {
                    sourceInfo.Source.Stop();
                }
            }
        }
Exemplo n.º 9
0
        public void SetVolume(AudioHandle handle, float volume, float duration)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo(handle);

            if (sourceInfo != null)
            {
                if (duration > 0.0f &&
                    !_isMuted)
                {
                    float deltaVolume = volume - sourceInfo.Source.volume;
                    sourceInfo.VolumeFluctuationSpeed = deltaVolume / duration;
                    sourceInfo.TargetVolume           = volume;
                }
                else
                {
                    SetSourceVolume(sourceInfo, volume);
                }
            }
        }
Exemplo n.º 10
0
    public Uzu.AudioHandle PlayBgm(string clipId, bool loop = true)
    {
        if (loop && clipId == _last_clipid) {
            return _activeBGMHandle;
        }
        _last_clipid = clipId;

        StopBgm();

        // Play sound.
        {
            Uzu.AudioController.PlayOptions options = new Uzu.AudioController.PlayOptions ();
            options.Loop = loop;
            options.Volume = BGM_VOLUME;
            options.FadeInTime = FADE_IN_TIME;
            _activeBGMHandle = _audioController.Play (clipId, options);
        }
        return _activeBGMHandle;
    }
Exemplo n.º 11
0
    public override void OnEnter(Uzu.PanelEnterContext context)
    {
        _bgm_handle = Main.AudioController.PlayBgm(AudioClipIds.BGM_MAIN_LOOP);

        _bgm_handle._handle_audio_source.outputAudioMixerGroup = _bgm_mixer_group;

        _audio_normal_snapshot = _bgm_mixer_group.audioMixer.FindSnapshot("Normal");
        _audio_paused_snapshot = _bgm_mixer_group.audioMixer.FindSnapshot("Paused");

        this.bgm_audio_set_paused_mode(false);

        gameObject.SetActive(true);
        _home_score.set_string("0");
        _home_score.set_string("0");
        _time_text.set_string("0:00:00");
        set_pause_icon_alpha(0);
        _tar_pause_icon_alpha = 0;
        _quarter_text.set_string(Main.LevelController._quarter_display);
        //Main.LevelController.StartLevel();
        _fadein.set_alpha(1.0f);
        _fadein.set_target_alpha(0.0f);
    }
Exemplo n.º 12
0
        public AudioHandle Play(string clipId, PlayOptions options)
        {
            AudioClip clip = GetClip(clipId);

            if (clip != null)
            {
                AudioHandle     handle     = GetSource();
                AudioSourceInfo sourceInfo = GetSourceInfo(handle);
                if (sourceInfo != null)
                {
                    AudioSource source = sourceInfo.Source;
                    source.clip = clip;
                    source.loop = options.Loop;
                    source.transform.localPosition = options.Position;

                    sourceInfo.ClipId       = clipId;
                    sourceInfo.TargetVolume = options.Volume;

                    if (options.FadeInTime > 0.0f &&
                        !_isMuted)
                    {
                        sourceInfo.VolumeFluctuationSpeed = sourceInfo.TargetVolume / options.FadeInTime;
                        source.volume = 0.0f;
                    }
                    else
                    {
                        SetSourceVolume(sourceInfo, sourceInfo.TargetVolume);
                    }

                    source.Play();

                    handle._handle_audio_source = source;
                }

                return(handle);
            }

            return(new AudioHandle());
        }
Exemplo n.º 13
0
    public override void OnEnter(Uzu.PanelEnterContext context)
    {
        Main.GameCamera.gameObject.SetActive(false);
        Main.Instance._tvCamera.gameObject.SetActive(false);
        Main.Instance._titleCamera.transform.parent.gameObject.SetActive(true);
        gameObject.SetActive(true);
        _intro_bgm_handle = Main.AudioController.PlayBgm(AudioClipIds.BGM_MENU_INTRO, false);

        sprite_set_alpha(_spotco_logo, 0);
        sprite_set_alpha(_mnm_base, 1);
        sprite_set_alpha(_mnm_logo, 1);
        sprite_set_y(_mnm_logo, -280);
        sprite_set_alpha(_mnm_base, 1);
        sprite_set_alpha(_cover, 1);
        sprite_set_alpha(_click_anywhere_to_start, 0);
        sprite_set_alpha(_credits, 0);
        _camera_fade.set_alpha(1);
        _camera_fade.set_target_alpha(1);

        _current_state = TitleState.SpotcoLogoIn;

        _anim_t = 0;
    }
Exemplo n.º 14
0
    public override void OnEnter(Uzu.PanelEnterContext context)
    {
        Main.GameCamera.gameObject.SetActive(false);
        Main.Instance._tvCamera.gameObject.SetActive(false);
        Main.Instance._titleCamera.transform.parent.gameObject.SetActive(true);
        gameObject.SetActive(true);
        _intro_bgm_handle = Main.AudioController.PlayBgm(AudioClipIds.BGM_MENU_INTRO,false);

        sprite_set_alpha(_spotco_logo,0);
        sprite_set_alpha(_mnm_base,1);
        sprite_set_alpha(_mnm_logo,1);
        sprite_set_y(_mnm_logo,-280);
        sprite_set_alpha(_mnm_base,1);
        sprite_set_alpha(_cover,1);
        sprite_set_alpha(_click_anywhere_to_start,0);
        sprite_set_alpha(_credits,0);
        _camera_fade.set_alpha(1);
        _camera_fade.set_target_alpha(1);

        _current_state = TitleState.SpotcoLogoIn;

        _anim_t = 0;
    }
Exemplo n.º 15
0
    public override void OnEnter(Uzu.PanelEnterContext context)
    {
        _bgm_handle = Main.AudioController.PlayBgm(AudioClipIds.BGM_MAIN_LOOP);

        _bgm_handle._handle_audio_source.outputAudioMixerGroup = _bgm_mixer_group;

        _audio_normal_snapshot = _bgm_mixer_group.audioMixer.FindSnapshot("Normal");
        _audio_paused_snapshot = _bgm_mixer_group.audioMixer.FindSnapshot("Paused");

        this.bgm_audio_set_paused_mode(false);



        gameObject.SetActive(true);
        _home_score.set_string("0");
        _home_score.set_string("0");
        _time_text.set_string("0:00:00");
        set_pause_icon_alpha(0);
        _tar_pause_icon_alpha = 0;
        _quarter_text.set_string(Main.LevelController._quarter_display);
        //Main.LevelController.StartLevel();
        _fadein.set_alpha(1.0f);
        _fadein.set_target_alpha(0.0f);
    }
Exemplo n.º 16
0
 public bool IsHandleValid(AudioHandle handle)
 {
     return GetSourceInfo (handle) != null;
 }
Exemplo n.º 17
0
 public bool IsHandleValid(AudioHandle handle)
 {
     return(GetSourceInfo(handle) != null);
 }
Exemplo n.º 18
0
 public void SetPitch(AudioHandle handle, float pitch)
 {
     AudioSourceInfo sourceInfo = GetSourceInfo (handle);
     if (sourceInfo != null) {
         sourceInfo.Source.pitch = pitch;
     }
 }
Exemplo n.º 19
0
 public void SetVolume(AudioHandle handle, float volume)
 {
     SetVolume (handle, volume, 0.0f);
 }
Exemplo n.º 20
0
 public void SetVolume(AudioHandle handle, float volume, float duration)
 {
     AudioSourceInfo sourceInfo = GetSourceInfo (handle);
     if (sourceInfo != null) {
         if (duration > 0.0f &&
             !_isMuted) {
             float deltaVolume = volume - sourceInfo.Source.volume;
             sourceInfo.VolumeFluctuationSpeed = deltaVolume / duration;
             sourceInfo.TargetVolume = volume;
         }
         else {
             SetSourceVolume (sourceInfo, volume);
         }
     }
 }
Exemplo n.º 21
0
 public void Stop(AudioHandle handle)
 {
     Stop (handle, 0.0f);
 }
Exemplo n.º 22
0
 public void Stop(AudioHandle handle, float fadeOutTime)
 {
     AudioSourceInfo sourceInfo = GetSourceInfo (handle);
     if (sourceInfo != null) {
         if (fadeOutTime > 0.0f &&
             !_isMuted) {
             sourceInfo.VolumeFluctuationSpeed = -sourceInfo.Source.volume / fadeOutTime;
             sourceInfo.TargetVolume = 0.0f;
         }
         else {
             sourceInfo.Source.Stop ();
         }
     }
 }
Exemplo n.º 23
0
 public void SetVolume(AudioHandle handle, float volume)
 {
     SetVolume(handle, volume, 0.0f);
 }
Exemplo n.º 24
0
        private AudioSourceInfo GetSourceInfo(AudioHandle handle)
        {
            if (handle.Id != AudioHandle.INVALID_ID) {
                AudioSourceInfo sourceInfo = _sourceInfos [handle.Index];

                // Verify handle integrity.
                if (sourceInfo.HandleId == handle.Id) {
                    return sourceInfo;
                }
            }

            return null;
        }
Exemplo n.º 25
0
        public float GetPitch(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo (handle);
            if (sourceInfo != null) {
                return sourceInfo.Source.pitch;
            }

            return 1.0f;
        }
Exemplo n.º 26
0
 public void Stop(AudioHandle handle)
 {
     Stop(handle, 0.0f);
 }
Exemplo n.º 27
0
        public float GetVolume(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo (handle);
            if (sourceInfo != null) {
                return sourceInfo.Source.volume;
            }

            return 0.0f;
        }
Exemplo n.º 28
0
        public bool IsPlaying(AudioHandle handle)
        {
            AudioSourceInfo sourceInfo = GetSourceInfo (handle);
            if (sourceInfo != null) {
                return sourceInfo.Source.isPlaying;
            }

            return false;
        }