Ejemplo n.º 1
0
    async public static UniTask WaitUntilEvent(UnityEvent targetEvent)
    {
        Assert.IsNotNull(targetEvent);
        EventListener temp = new EventListener();

        targetEvent.AddListenerForOnce(() => temp.receive = true);
        await UniTask.WaitUntil(() => temp.receive);
    }
Ejemplo n.º 2
0
    async public static UniTask <T> WaitUntilEvent <T>(UnityEvent <T> targetEvent)
    {
        Assert.IsNotNull(targetEvent);
        EventListener <T> temp = new EventListener <T>();

        targetEvent.AddListenerForOnce((T res) => { temp.receive = true; temp.result = res; });
        await UniTask.WaitUntil(() => temp.receive);

        return(temp.result);
    }
Ejemplo n.º 3
0
 public void AddListenerForOnce(UnityAction t)
 {
     eChange.AddListenerForOnce(t);
 }