Exemple #1
0
    protected CoroutineManagerCarrier carrier; // l'objet qui permet d'appel les StartCoroutine()

    public CoroutineManager()
    {
        history = new List <CoroutineInfo>();

        GameObject obj = GameObject.Find("[coroutine]");

        if (obj == null)
        {
            obj = GameObject.Find("(coroutine)");
        }
        if (obj == null)
        {
            obj = new GameObject("(coroutine)", typeof(CoroutineManagerCarrier));
        }

        carrier = obj.GetComponent <CoroutineManagerCarrier>();
        if (carrier == null)
        {
            Debug.LogError("{CoroutineManager} No carrier ?");
        }

        GameObject.DontDestroyOnLoad(carrier);

        layers = new CoroutineLayer[Enum.GetNames(typeof(CoroutineLayerId)).Length];
        for (int i = 0; i < layers.Length; i++)
        {
            layers[i] = new CoroutineLayer((CoroutineLayerId)i);
        }
        //Debug.Log("setup");
    }
Exemple #2
0
    public bool killed  = false; // s'interrompt au milieu et ne balance pas la suite (si callback)

    public CoroutineInfo(IEnumerator fct, MonoBehaviour caller, CoroutineLayer layer)
    {
        this.layer = layer;
        layer.infos.Add(this);

        this.caller   = caller;
        this.function = fct;
        state         = CoroutineState.NONE;
    }