Unity 自定义 YieldInstruction

using System;
using UnityEngine;

// Implementation of WaitWhile yield instruction. This can be later used as:
// yield return new WaitWhile(() => Princess.isInCastle);
class WaitWhile : CustomYieldInstruction
{
    Func m_Predicate;

    public override bool keepWaiting
    {
        get
        {
            return m_Predicate();
        }
    }

    public WaitWhile(Func predicate)
    {
        m_Predicate = predicate;
    }
}

http://docs.unity3d.com/ScriptReference/CustomYieldInstruction.html

你可能感兴趣的:(Unity 自定义 YieldInstruction)