当前位置: 首页>>代码示例>>C#>>正文


C# Tween.PathLength方法代码示例

本文整理汇总了C#中Tween.PathLength方法的典型用法代码示例。如果您正苦于以下问题:C# Tween.PathLength方法的具体用法?C# Tween.PathLength怎么用?C# Tween.PathLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tween的用法示例。


在下文中一共展示了Tween.PathLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	// Use this for initialization
	void Start () {
		tween = null;
		endPoint = GameObject.Find ("EndPoint");
		wayPointObj = GameObject.Find("Waypoints");
		waypointArray = new Vector3[wayPointObj.transform.childCount + 1];
		for (int i = 0; i < waypointArray.Length - 1; i++) {
			waypointArray[i] = wayPointObj.transform.GetChild(i).position;
		}
		waypointArray[waypointArray.Length - 1] = endPoint.transform.position;

		transform.position = waypointArray[0];
		tween = transform.DOPath (waypointArray, 0.0f, PathType.CatmullRom, PathMode.TopDown2D, 10, Color.red);
		tween.SetSpeedBased();
		tween.SetEase(Ease.Linear);
		tween.ForceInit();

		pathLength = tween.PathLength();
	}
开发者ID:oocast,项目名称:Zuagon,代码行数:19,代码来源:PathRouter.cs

示例2: Start

	void Start()
	{
		return;

		Vector3[] path = new[] {
			new Vector3(0,1,0),
			new Vector3(1,2,0),
			new Vector3(2,1,0),
			new Vector3(2,0,0)
		};

		TweenParams tp = new TweenParams()
			.SetEase(ease)
			.SetLoops(-1, loopType);

		AxisConstraint lockRotation = lockRotation0 | lockRotation1;

		// Relative VS non relative
		controller = targets[0].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[1].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(targets[2], forward)
			.SetAs(tp)
			.Pause();

		// Linear VS curved
		targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(new Vector3(3, 0, 0), forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();

		// Linear VS curved no lookAt
		targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetAs(tp)
			.SetRelative()
			.Pause();

		// Linear VS curved top-down
		path = new[] {
			new Vector3(0,0,1),
			new Vector3(1,0,2),
			new Vector3(2,0,1),
			new Vector3(2,0,0)
		};
		targets[6].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[7].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();

		// Log lengths
		controller.ForceInit();
		Debug.Log("Controller path length: " + controller.PathLength());
	}
开发者ID:kanon1109,项目名称:dotween,代码行数:80,代码来源:Paths.cs


注:本文中的Tween.PathLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。