/// <summary> /// Move extension method for TransitionStep /// </summary> /// <typeparam name="T">interface type</typeparam> /// <param name="TransitionStep"></param> /// <returns></returns> public static Move MoveToOriginal(this TransitionStep transitionStep, Vector3 startPosition, float delay = 0, float duration = 0.5f, TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear, AnimationCurve animationCurve = null, TransitionStep.CoordinateSpaceType coordinateMode = TransitionStep.CoordinateSpaceType.Global, bool runAtStart = false, Action onStart = null, Action<float> onUpdate = null, Action onComplete = null) { var newTransitionStep = new Move(transitionStep.Target, startPosition, Vector3.zero, delay, duration, TransitionStep.TransitionModeType.ToOriginal, tweenType, animationCurve, coordinateMode, onStart, onUpdate, onComplete); if (runAtStart) transitionStep.AddOnStartTransitionStep(newTransitionStep); else transitionStep.AddOnCompleteTransitionStep(newTransitionStep); newTransitionStep.Parent = transitionStep; return newTransitionStep; }
void Start() { ShowTransitionedDescription("Basic linked transitions with events"); // Create a new transition to move the gameobject with a delay of 1 and duration of 3 and the specified actions var startPosition = new Vector3(10, 0, 0); var endPosition = Vector3.zero; var transition = new Move(TestGameObject, startPosition, endPosition, 1, 3, tweenType: TransitionHelper.TweenType.easeInOutBack, onStart: LogStart, onUpdate: LogUpdate, onComplete: LogComplete); // Add an additional complete action with custom data transition.AddOnCompleteAction(LogComplete, "Complete Parameter"); // chaing some additional transitions and on complete call next transition transition.ScaleToOriginal(Vector3.zero, 1, 1, runAtStart: true). RotateFromOriginal(new Vector3(360, 0, 0), 1, 3, coordinateMode: TransitionStep.CoordinateSpaceType.Local, runAtStart: true). RotateToOriginal(new Vector3(180, 0, 0), duration: 2). ScaleFromOriginal(Vector3.zero, delay: 1, duration: 2, runAtStart: true, onComplete: TransitionItem2); // start everything. transition.Start(); }