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


C# Rect.GetTopRight方法代码示例

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


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

示例1: DrawQuad

		/// <summary>
		/// 	Draws the quad.
		/// </summary>
		/// <param name="rect">Rect.</param>
		/// <param name="uvs">Uvs.</param>
		public static void DrawQuad(Rect rect, Rect uvs)
		{
			GL.TexCoord(uvs.GetBottomLeft());
			GL.Vertex(rect.GetBottomLeft());

			GL.TexCoord(uvs.GetTopLeft());
			GL.Vertex(rect.GetTopLeft());

			GL.TexCoord(uvs.GetTopRight());
			GL.Vertex(rect.GetTopRight());

			GL.TexCoord(uvs.GetBottomRight());
			GL.Vertex(rect.GetBottomRight());
		}
开发者ID:JustJessTV,项目名称:GitMergeTest,代码行数:19,代码来源:GLUtils.cs

示例2: Intersects

		/// <summary>
		/// 	Returns the number of intersections with the given rectangle.
		/// </summary>
		/// <param name="rect">Rect.</param>
		/// <param name="finiteThis">If set to <c>true</c> this line is finite.</param>
		/// <param name="intersections">Intersections.</param>
		public int Intersects(Rect rect, bool finiteThis, ref Vector2[] intersections)
		{
			int output = 0;

			Array.Resize(ref intersections, 4);

			Vector2 topLeft = rect.GetTopLeft();
			Vector2 topRight = rect.GetTopRight();
			Vector2 bottomLeft = rect.GetBottomLeft();
			Vector2 bottomRight = rect.GetBottomRight();

			Line2d top = new Line2d(topLeft, topRight);
			Line2d bottom = new Line2d(bottomLeft, bottomRight);
			Line2d left = new Line2d(topLeft, bottomLeft);
			Line2d right = new Line2d(topRight, bottomRight);

			Vector2 intersection;

			if (Intersects(top, finiteThis, true, out intersection))
			{
				intersections[output] = intersection;
				output++;
			}

			if (Intersects(bottom, finiteThis, true, out intersection))
			{
				intersections[output] = intersection;
				output++;
			}

			if (Intersects(left, finiteThis, true, out intersection))
			{
				intersections[output] = intersection;
				output++;
			}

			if (Intersects(right, finiteThis, true, out intersection))
			{
				intersections[output] = intersection;
				output++;
			}

			return output;
		}
开发者ID:JustJessTV,项目名称:GitMergeTest,代码行数:50,代码来源:Line2d.cs

示例3: DrawRect

		/// <summary>
		/// 	Draws the rect.
		/// </summary>
		/// <param name="rect">Rect.</param>
		/// <param name="color">Color.</param>
		/// <param name="duration">Duration.</param>
		public static void DrawRect(Rect rect, Color color, float duration)
		{
			Vector2 topLeft = rect.GetTopLeft();
			Vector2 topRight = rect.GetTopRight();
			Vector2 bottomLeft = rect.GetBottomLeft();
			Vector2 bottomRight = rect.GetBottomRight();

			Debug.DrawLine(topLeft, topRight, color, duration);
			Debug.DrawLine(bottomLeft, bottomRight, color, duration);
			Debug.DrawLine(topLeft, bottomLeft, color, duration);
			Debug.DrawLine(topRight, bottomRight, color, duration);
		}
开发者ID:JustJessTV,项目名称:GitMergeTest,代码行数:18,代码来源:DebugUtils.cs


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