以下の内容はhttps://baba-s.hatenablog.com/entry/2018/03/23/085700より取得しました。


【Unity】コルーチンを連結できる「CoroutineChain」紹介(無料)

f:id:baba_s:20180219091134p:plain

概要

 
2018/2/9 に「CoroutineChain」がリリースされました
「CoroutineChain」を導入すると、
コルーチンを連結できるようになります

検証環境

  • Unity 2017.3.0f3
  • CoroutineChain 0.1.1

使用例

using System.Collections;
using UnityEngine;

public class Example : MonoBehaviour
{
    private IEnumerator Start()
    {
        var time = 1f;

        while ( true )
        {
            yield return CoroutineChain.Start
                .Play( MoveToForSec( Vector3.up, time ) )
                .Wait( time )
                .Play( MoveToForSec( Vector3.zero, time ) )
                .Wait( time )
                .Play( MoveToForSec( Vector2.one, time ) )
                .Wait( time )
                .Play( MoveToForSec( Vector3.right, time ) )
                .Wait( time )
                .Parallel( MoveToForSec( Vector3.up, time ), MoveToForSec( Vector2.one, time ) )
                .Log( "Parallel 完了" )
                .Wait( time )
                .Sequential( MoveToForSec( Vector3.zero, time ), MoveToForSec( Vector3.right, time ) )
                .Log( "Sequential 完了" )
                .Wait( time )
                .Call( () => print( "完了" ) )
            ;
        }
    }

    private IEnumerator MoveToForSec( Vector3 pos, float time )
    {
        yield return new WaitForSeconds( time );
    }
}



以上の内容はhttps://baba-s.hatenablog.com/entry/2018/03/23/085700より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14