Esempio n. 1
0
        private void ComposeSequence()
        {
            sequence         = SuperInvoke.CreateSequence();
            movementDuration = SliderInScene.value / 2f;                                        // 2 movements of equal duration

            sequence.AddMethod(() => bombMover.MoveTo(new Vector2(0, 2.2f), movementDuration)); // move up
            sequence.AddDelay(movementDuration);

            // after the previous delay, rotate and move to right and down
            sequence.AddMethod(() => bombRotator.RotateZ(20f));
            sequence.AddMethod(() => bombMover.MoveTo(new Vector2(4.5f, -0.5f), movementDuration));
            sequence.AddDelay(movementDuration);

            // at the end, bomb explodes
            sequence.AddMethod(() => bombScaler.Scale(0));
            sequence.AddMethod(() => explosion.Play());
        }
Esempio n. 2
0
        private void ComposeSequence()
        {
            sequence = SuperInvoke.CreateSequence();

            sequence.AddMethod(ResetTransform);                                     // reset position, scale, and rotation for every repeat

            // divided by two because there are two movements in two different point
            // so that the repeat and the movements are synced, i.e. total movements time = repeat rate
            float oneMovementDuration = RepeatRate / 2f;


            sequence.AddMethod(() => bombMover.MoveTo(new Vector2(0, 2.2f), oneMovementDuration));                                    // move to up

            sequence.AddDelay(oneMovementDuration);
            sequence.AddMethod(() => bombRotator.RotateZ(20f));
            sequence.AddMethod(() => bombMover.MoveTo(new Vector2(4.5f, -0.5f), oneMovementDuration));

            sequence.AddDelay(oneMovementDuration);
            sequence.AddMethod(() => bombScaler.Scale(0));
            sequence.AddMethod(() => explosion.Play());
        }