コード例 #1
0
    IEnumerator PlayCoroutine(int voiceNumber)
    {
        //// 改行処理
        //char[] c = { 'n' };

        //var _strs = serifuList[voiceNumber].Split(c);

        //serifuText.text = "";
        //for(int i = 0; i < _strs.Length; ++i )
        //{
        //    serifuText.text += _strs[i];
        //    if ( i < _strs.Length - 1 ) serifuText.text += "\n";
        //}

        G20_SEType seType = GetSEType((G20_VoiceType)voiceNumber);

        captionPerformer.StartPerformance(serifuList[voiceNumber], new G20_CaptionParam(0.5f, 0.4f, 0f));
        yield return(new WaitForSecondsRealtime(voiceDelayFromCaption));

        PlaySELimit(seType);
        float seLength             = G20_SEManager.GetInstance().GetClipLength(seType);
        float minLength            = 1.0f;
        float displayCaptionLength = Mathf.Max(minLength, seLength - 1.0f);

        yield return(new WaitForSeconds(displayCaptionLength));

        captionPerformer.StopPerformance();
    }
コード例 #2
0
 void PlaySELimit(G20_SEType seType)
 {
     if (audioSource && audioSource.isPlaying)
     {
         audioSource.Stop();
     }
     audioSource = G20_SEManager.GetInstance().Play(seType, Vector3.zero, false);
 }
コード例 #3
0
    // 字幕表示なし
    // 再生中はBGM音量下げる
    public void PlayWithNoCaption(G20_VoiceType voiceNumber)
    {
        // 字幕表示しないボイス再生
        G20_SEType seType = GetSEType(voiceNumber);

        PlaySELimit(seType);
        float clipLength = G20_SEManager.GetInstance().GetClipLength(seType);

        G20_BGMManager.GetInstance().VolumeDown(clipLength);
    }
コード例 #4
0
    public AudioSource Play(G20_SEType seType, Vector3 position, bool playIn3DVolume = true)
    {
        var obj = Instantiate(sePlayPrefab, transform);

        obj.transform.position = position;
        var audioSource = obj.GetComponent <AudioSource>();
        var clip        = seClips[(int)seType];

        if (clip == null)
        {
            return(audioSource);
        }
        audioSource.clip = clip;

        if (!playIn3DVolume)
        {
            // 3D的なボリューム調節をしない
            audioSource.spatialBlend = 0f;
        }

        if ((int)seType < seVolumes.Length)
        {
            audioSource.volume = seVolumes[(int)seType];
        }
        else
        {
            audioSource.volume = 1f;
        }

        // 自動消滅時間の設定
        var autoDestroy = obj.GetComponent <G20_AutoDestroy>();

        if (autoDestroy)
        {
            autoDestroy.destroyTime = clip.length + 0.5f;
        }

        // ボイスは必ず鳴って欲しい
        if (seType >= G20_SEType.TEST_VOICE &&
            seType <= G20_SEType.VOICE22)
        {
            audioSource.priority = 118;
        }

        audioSource.Play();

        return(audioSource);
    }
コード例 #5
0
 public void ChangeSEType(G20_SEType _seType)
 {
     seType = _seType;
 }
コード例 #6
0
    public static string GetTypeName(this G20_SEType _type)
    {
        string retStr = "";

        switch (_type)
        {
        case G20_SEType.HIT_HEAD:
            retStr = "hit_head";
            break;

        case G20_SEType.HIT_GOLDHEAD:
            retStr = "hit_goldhead";
            break;

        case G20_SEType.HIT_BODY:
            retStr = "hit_body";
            break;

        case G20_SEType.SUMMON_APPLE:
            retStr = "enemy";
            break;

        case G20_SEType.BOMB:
            retStr = "bomb";
            break;

        case G20_SEType.APPLE_FALL:
            retStr = "apple_fall";
            break;

        case G20_SEType.GESSLER_FLIGHT:
            retStr = "gesura-flight";
            break;

        case G20_SEType.PLAYER_DAMAGE:
            retStr = "player_damage";
            break;

        case G20_SEType.SMALL_APPLE_ATTACK:
            retStr = "smallapple_attack";
            break;

        case G20_SEType.WALK_WEAK:
            retStr = "walk_weak";
            break;

        case G20_SEType.WALK_STRONG:
            retStr = "walk_strong";
            break;

        case G20_SEType.WALK_STOP:
            retStr = "walk_stop";
            break;

        case G20_SEType.FOREST:
            retStr = "forest_BGM";
            break;

        case G20_SEType.BARRIER:
            retStr = "barrier_pattern2";
            break;

        case G20_SEType.HIGH_SCORE:
            retStr = "score";
            break;

        case G20_SEType.HIT_HEAD_B:
            retStr = "hit_headB";
            break;

        case G20_SEType.BARRIER_EXTINCTION:
            retStr = "barrier_Extinction";
            break;

        case G20_SEType.APPLE_VOICE_SMALL:
            retStr = "apple_voice_small";
            break;

        case G20_SEType.APPLE_VOICE_NORMAL:
            retStr = "apple_voice_normal";
            break;

        case G20_SEType.APPLE_VOICE_NORMAL2:
            retStr = "apple_voice_normal2";
            break;

        case G20_SEType.HIT_GOLDHEAD_2:
            retStr = "hit_gold_2nd";
            break;

        case G20_SEType.TEST_VOICE:
            retStr = "test_voice";
            break;

        case G20_SEType.CHAIN1:
            retStr = "Chain_1";
            break;

        case G20_SEType.CHAIN2:
            retStr = "Chain_2";
            break;

        case G20_SEType.CHAIN3:
            retStr = "Chain_3";
            break;

        case G20_SEType.FLIGHTBOSS:
            retStr = "flight_boss";
            break;

        default:
            retStr = "voice" + ((int)(_type - G20_SEType.VOICE0)).ToString();
            break;
        }

        return(retStr);
    }
コード例 #7
0
 public float GetClipLength(G20_SEType seType)
 {
     return(seClips[(int)seType].length);
 }