Google Drive for Unity3D

Midworld.UnityCoroutine Class Reference

Unity3D coroutine object. More...

Inheritance diagram for Midworld.UnityCoroutine:
Midworld.UnityWebResponse

List of all members.

Public Member Functions

 UnityCoroutine (Action< UnityCoroutine > doneCallback)
 Create a Unity coroutine with the done callback.
void DoSync ()
 Run all remaining routines at this time.
bool MoveNext ()
 Run the routines.
void Reset ()
 Clear queued routines.

Protected Member Functions

 UnityCoroutine ()
 Create a Unity coroutine without the done callback.

Protected Attributes

Queue< Action > routines = new Queue<Action>()
 Run the routines one at a time(each routine at each update).

Properties

bool isDone [get, set]
 All processing is done.
Action< UnityCoroutinedone [get, set]
 Done callback function getter/setter.
object Current [get]
 Remaining routines count.

Detailed Description

Unity3D coroutine object.

Usage with Unity3D coroutine.

        IEnumerator SomeCoroutine()
        {
            // Wait for the coroutine to finish.
            yield return StartCoroutine(new SomeUnityCoroutine1());

            // Do something after 'SomeUnityCoroutine1' finished.
            // ...

            // Run this coroutine and 'SomeUnityCorutine2' at same time.
            SomeUnityCoroutine2 routine2 = new SomeUnityCoroutine2();
            StartCoroutine(routine2);

            // Do parallel works.
            // ...

            // And wait for 'SomeUnityCoroutine2'.
            while (!routine2.isDone)
                yield return null;
        }

Usage with the done callback.

        StartCoroutine(new SomeUnityCoroutine((coroutine) =>
        {
            // Done!

            SomeUnityCoroutine r = coroutine as SomeUnityCoroutine;

            print(r.someResult);

            // ...
        }));

Constructor & Destructor Documentation

Midworld.UnityCoroutine.UnityCoroutine ( ) [protected]

Create a Unity coroutine without the done callback.

Midworld.UnityCoroutine.UnityCoroutine ( Action< UnityCoroutine doneCallback)

Create a Unity coroutine with the done callback.

Parameters:
doneCallbackDone callback function.

Member Function Documentation

void Midworld.UnityCoroutine.DoSync ( )

Run all remaining routines at this time.

bool Midworld.UnityCoroutine.MoveNext ( )

Run the routines.

Returns:
Is there remaining work.
void Midworld.UnityCoroutine.Reset ( )

Clear queued routines.


Member Data Documentation

Queue<Action> Midworld.UnityCoroutine.routines = new Queue<Action>() [protected]

Run the routines one at a time(each routine at each update).

Do not dequeue manually.


Property Documentation

object Midworld.UnityCoroutine.Current [get]

Remaining routines count.

Action<UnityCoroutine> Midworld.UnityCoroutine.done [get, set]

Done callback function getter/setter.

Done callback run immediately if the coroutine is already done.

bool Midworld.UnityCoroutine.isDone [get, set]

All processing is done.

Callback the done function only once when the flag set true. If this UnityCorouine started by StartCoroutine() then done function will run in main thread. If it is not then the function will run in the working thread.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Properties