Beispiel #1
0
    void Start()
    {
        // Instantiate
        queue = new TeaTime(this);
        // or you can use this shortcut: 'queue = this.tt();' (special
        // MonoBehaviour extension)

        // Adds a one second callback loop that lerps to a random color.
        queue
        .Add(() => Debug.Log("Queue Beginning " + Time.time))
        .Loop(1, (ttHandler t) =>
        {
            // From white to black, using .t (completion float from 0.0 to 1.0)
            cubeRen.material.color = Color.Lerp(
                Color.white,
                Color.black,
                t.t);
        })
        .Loop(1, (ttHandler t) =>
        {
            cubeRen.transform.localScale = Vector3.Lerp(
                new Vector3(1, 1, 1),
                new Vector3(3, 3, 3),
                t.t);
        })
        .Add(() => Debug.Log("Queue End " + Time.time))
        .Yoyo();
        // Yoyo mode will .Reverse() the queue execution order when the queue is
        // completed
    }
Beispiel #2
0
    void Start()
    {
        TeaTime queue = this.tt();

        // Every second
        this.tt().Add(1, () =>
        {
            // Append lots of Adds & Loops
            for (int i = 0; i < 10000; i++)
            {
                // Call them quick
                queue.Add(0.10f, (ttHandler t) =>
                {
                    addFrameCount += 1;
                })
                .Loop(0.10f, (ttHandler t) =>
                {
                    loopFrameCount += 1;
                });
            }
        })
        // Forever
        .Repeat();
    }