Stagger() public static method

Plays transitions in parallel, with a specified interval between each one.
public static Stagger ( float staggerOffset ) : U9ParallelTransition,
staggerOffset float /// Start time offset. ///
return U9ParallelTransition,
コード例 #1
0
ファイル: OnScoreTransition.cs プロジェクト: bigstupidx/swip3
    public U9Transition CreateOnScoreTransition(List <Block> blocks, int layer, int tScore)
    {
        int layerMask = 1 << layer;

        layerMask         = ~layerMask;
        Proj.ignoreLayers = layerMask;

        U9Transition onScoreTransition = null;

        transform.parent     = blocks[blocks.Count / 2].transform;
        transform.localScale = Vector3.one;

        //onScoreTransition = U9T.T (iTween.MoveTo, this.gameObject, iTween.Hash("position", new Vector3(0, 0, -1000), "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));

        //onScoreTransition.Ended += (transition) =>
        //{
        float staggerTime = 0f;                //0.45f;
        List <U9Transition> transitions = new List <U9Transition> ();

        foreach (Block m in blocks)
        {
            transitions.Add(m.CreateDisappearTransition(tScore));
        }

        staggerTime = staggerTime / transitions.Count;

        U9Transition t = U9T.Stagger(staggerTime, transitions.ToArray());

        t.Begin();

        Destroy(this.gameObject);
        //};

        return(new InstantTransition(onScoreTransition));
    }
コード例 #2
0
    U9Transition CreateCompositeTransition(U9Transition[] ts)
    {
        switch (compositionType)
        {
        case CompositionType.Parallel:
            return(U9T.P(ts));

        case CompositionType.Serial:
            return(U9T.S(ts));

        case CompositionType.Stagger:
            return(U9T.Stagger(0.1f, ts));

        default:
            return(null);
        }
    }
コード例 #3
0
    /// <summary>
    /// Causes all blocks to disappear
    /// </summary>
    /// <returns>The clear board transition.</returns>
    U9Transition CreateClearBoardTransition()
    {
        List <U9Transition> transitions = new List <U9Transition> ();

        for (int i = 0, ni = gridSize; i < ni; i++)
        {
            for (int j = 0, nj = gridSize; j < nj; j++)
            {
                Block b = blocks [i, j];
                if (b)
                {
                    transitions.Add(b.CreateDisappearTransition(0));
                }
            }
        }

        // Randomises the order of the disappear transitions to make it more pretty!
        List <U9Transition> randomisedTransitions = GetRandomSubset(transitions, transitions.Count);

        float staggerTime = 0.025f;         // 0.025f;

        return(U9T.Stagger(staggerTime, randomisedTransitions.ToArray()));
    }
コード例 #4
0
ファイル: U9T.cs プロジェクト: bigstupidx/swip3
    public static U9SerialTransition PrioritySequence(U9Transition[] transitions, float staggerTime = 0f)
    {
        //Debug.Log ("START PRIORITY SEQUENCE -------------");
        List <U9Transition> transList = new List <U9Transition>(transitions);
        //transList.Sort( CompareTransitionPriority );
        IEnumerable enumerator = transList.OrderBy(t => t.Priority);

        int?currentPriority               = null;
        U9SerialTransition  serial        = new U9SerialTransition();
        List <U9Transition> parallelGroup = new List <U9Transition> ();

        foreach (U9Transition t in enumerator)
        {
            if (t != null)
            {
                if (t.Priority != currentPriority)
                {
                    if (parallelGroup.Count > 0)
                    {
                        //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count );
                        serial.AddTransition(U9T.Stagger(staggerTime, parallelGroup.ToArray()));
                        parallelGroup.Clear();
                    }
                    currentPriority = t.Priority;
                }
                parallelGroup.Add(t);
            }
        }
        if (parallelGroup.Count > 0)
        {
            //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count );
            serial.AddTransition(U9T.Stagger(staggerTime, parallelGroup.ToArray()));
            parallelGroup.Clear();
        }
        return(serial);
    }
コード例 #5
0
    /// <summary>
    /// Creates a transition that hifts all of the blocks on the board away from the given edge.
    /// Note that this must be done in a specific order - blocks that are furthest away from the
    /// given edge must be shifted first or blocks will be blocked by other blocks that have yet
    /// to move out of the way
    /// </summary>
    /// <returns>The shift blocks transition.</returns>
    /// <param name="edge">Edge.</param>
    U9Transition CreateShiftBlocksTransition(Edge edge)
    {
        List <U9Transition> transitions = new List <U9Transition> ();

        switch (edge)
        {
        case Edge.Top:

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                for (int j = 1, nj = gridSize - 1; j < nj; j++)
                {
                    transitions.Add(CreateShiftBlockTransition(i, j, edge));
                }
            }

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                transitions.Add(CreateShiftBlockTransition(i, gridSize - 1, edge));
            }
            break;

        case Edge.Bottom:

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                for (int j = gridSize - 2; j > 0; j--)
                {
                    transitions.Add(CreateShiftBlockTransition(i, j, edge));
                }
            }

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                transitions.Add(CreateShiftBlockTransition(i, 0, edge));
            }
            break;

        case Edge.Left:

            for (int i = gridSize - 2; i > 0; i--)
            {
                for (int j = 1, nj = gridSize - 1; j < nj; j++)
                {
                    transitions.Add(CreateShiftBlockTransition(i, j, edge));
                }
            }

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                transitions.Add(CreateShiftBlockTransition(0, i, edge));
            }
            break;

        case Edge.Right:

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                for (int j = 1, nj = gridSize - 1; j < nj; j++)
                {
                    transitions.Add(CreateShiftBlockTransition(i, j, edge));
                }
            }

            for (int i = 1, ni = gridSize - 1; i < ni; i++)
            {
                transitions.Add(CreateShiftBlockTransition(gridSize - 1, i, edge));
            }
            break;
        }

        float staggerTime = 0.001f;        //0.5f;

        staggerTime = staggerTime / transitions.Count;

        return(U9T.Stagger(staggerTime, transitions.ToArray()));
        //return U9T.P (transitions.ToArray ());
    }