當前位置: 首頁>>代碼示例>>C#>>正文


C# Rect.GetTopLeft方法代碼示例

本文整理匯總了C#中UnityEngine.Rect.GetTopLeft方法的典型用法代碼示例。如果您正苦於以下問題:C# Rect.GetTopLeft方法的具體用法?C# Rect.GetTopLeft怎麽用?C# Rect.GetTopLeft使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.Rect的用法示例。


在下文中一共展示了Rect.GetTopLeft方法的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.GetTopLeft方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。