/// <summary> /// Returns a Tween instance that is configured to animate a Transform along a spline path /// </summary> /// <param name="component">The component whose position will be animated along the path</param> /// <param name="path">The Spline path to follow</param> /// <param name="orientToPath">If set to TRUE, the object will be oriented to match the path's direction</param> public static Tween <float> TweenPath(this Component component, IPathIterator path, bool orientToPath) { if (component == null) { throw new ArgumentNullException("component"); } return(TweenTransformExtensions.TweenPath(component.transform, path)); }
/// <summary> /// Returns a Tween instance that is configured to animate a Transform along a spline path /// </summary> /// <param name="transform">The Transfrom whose position will be animated along the path</param> /// <param name="path">The Spline path to follow</param> /// <param name="orientToPath">If set to TRUE, the object will be oriented to match the path's direction</param> public static Tween <float> TweenPath(this Transform transform, IPathIterator path, bool orientToPath) { if (transform == null) { throw new ArgumentNullException("transform"); } if (path == null) { throw new ArgumentNullException("path"); } // Declared here so that it can be referenced in the anonymous function assigned in OnExecute() Tween <float> tween = null; tween = Tween <float> .Obtain() .SetStartValue(0f) .SetEndValue(1f) .SetEasing(TweenEasingFunctions.Linear) .OnExecute((time) => { transform.position = path.GetPosition(time); if (orientToPath) { var direction = path.GetTangent(time); if (tween.PlayDirection == TweenDirection.Forward) { transform.forward = direction; } else { transform.forward = -direction; } } }); return(tween); }
public PrettyPathPainter(string path_provided, IPathIterator pathIterator) { _path_provided = path_provided; _path_iterator = pathIterator; }
public PrettyPathPainter(string path_provided,IPathIterator pathIterator) { _path_provided = path_provided; _path_iterator = pathIterator; }
/// <summary> /// Returns a Tween instance that is configured to animate a Transform along a spline path /// </summary> /// <param name="transform">The Transfrom whose position will be animated along the path</param> /// <param name="path">The Spline path to follow</param> public static Tween <float> TweenPath(this Transform transform, IPathIterator path) { return(TweenPath(transform, path, true)); }
/// <summary> /// Returns a Tween instance that is configured to animate a Transform along a spline path /// </summary> /// <param name="component">The component whose position will be animated along the path</param> /// <param name="path">The Spline path to follow</param> public static Tween <float> TweenPath(this Component component, IPathIterator path) { return(TweenPath(component, path, true)); }