示例#1
0
    void CheckForFalling()
    {
        var pairs = new List <KeyValuePair <int, int> >();

        if (leftGrid.CheckForFalling(pairs))
        {
            System.Action done = () => {
                animator.RewindTweens();    // reset the tweens
                for (int i = 0; i < pairs.Count; i++)
                {
                    leftGrid.MoveDown(pairs[i].Key, pairs[i].Value);
                }
                gridUpdated.Fire();
                this.isFalling = false; // falling end (for now)
                CheckForFalling();      // check again
            };
            // drop them all
            animator.AddTween(pairs[0].Key, pairs[0].Value, Vector3.down, true, done);
            for (int i = 1; i < pairs.Count; i++)
            {
                animator.AddTween(pairs[i].Key, pairs[i].Value, Vector3.down, true);
            }
            this.isFalling = true;   // we are falling
        }
    }