Esempio n. 1
0
        /// <summary>
        /// Coroutine which waits until movement queue reaches the point when this was called.
        /// That is if you queue in a bunch of orders and call this,
        /// you can yield on this and it will finish once all the previous orders are done.
        /// </summary>
        /// <returns>Coroutine.</returns>
        public IEnumerator WaitUntilMoveReachesThis()
        {
            // Magic using MovementArbitraryCoroutine and WaitForCallback. See WaitForCallback.
            WaitForCallback <CanBeMoved> waitHelper = new WaitForCallback <CanBeMoved>(MovementArbitraryCoroutine);

            yield return(GameManager.Instance.StartCoroutine(waitHelper.Do()));
        }
Esempio n. 2
0
    IEnumerator TestB()
    {
        Debug.Log("TestB Start-->" + Time.frameCount);

        var my = new WaitForCallback <string>(fun =>
        {
            Debug.Log(fun);
            AsyncFunc("BBB", fun);
        });

        yield return(my);

        Debug.Log("TestB End " + my.Result + "-->" + Time.frameCount);

        my = new WaitForCallback <string>(fun =>
        {
            Debug.Log(fun);
            AsyncFunc("bbbb", fun);
        });
        yield return(my);

        Debug.Log("TestB bbb End " + my.Result + "-->" + Time.frameCount);
    }