本文整理汇总了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());
}
示例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;
}
示例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);
}