Skip to content

Instantly share code, notes, and snippets.

@shinriyo
Created May 26, 2013 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinriyo/5652200 to your computer and use it in GitHub Desktop.
Save shinriyo/5652200 to your computer and use it in GitHub Desktop.
CSRectにメソッド追加
using UnityEngine;
using System.Collections;
public static class CSRect
{
public static Rect OffsetXRect(this Rect rect, float x)
{
Rect newRect = rect;
newRect.x = rect.x + x;
return newRect;
}
public static Rect OffsetYRect(this Rect rect, float y)
{
Rect newRect = rect;
newRect.y = rect.y + y;
return newRect;
}
public static Rect ResizeWidthRect(this Rect rect, float width)
{
Rect newRect = rect;
newRect.width = rect.width + width;
return newRect;
}
public static Rect ResizeHeightRect(this Rect rect, float height)
{
Rect newRect = rect;
newRect.width = rect.height + height;
return newRect;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment