private void Start() { Rect inner_rect = RectExtensions.CreateCenterRect(offset, size); Rect outer_rect = inner_rect.GetEnlarged(thickness); outer_rect.GetSubtraction(inner_rect).Process(r => this.AddComponent <BoxCollider2D>().SetLocalRect(r)); }
static public void DrawCenterRect(Vector2 center, Vector2 size) { GUI.DrawTexture( RectExtensions.CreateCenterRect(center, size), GetWhitePixelTexture() ); }
static public Rect GetWorldRect(this BoxCollider2D item) { return(RectExtensions.CreateCenterRect( item.transform.TransformPoint(item.offset), item.transform.TransformVector(item.size) )); }
static public Rect DrawSprite(Rect rect, Sprite sprite) { if (sprite != null) { rect = RectExtensions.CreateCenterRect(rect.center, sprite.GetTextureSize().GetFilledDimension(rect.size)); GUI.DrawTextureWithTexCoords( rect, sprite.texture, sprite.GetNormalizedTextureRect() ); } return(rect); }
public Rect GetRect() { return(RectExtensions.CreateCenterRect(this.GetPlanarPosition(), size)); }
static public Rect GetRect(this Vector2 item) { return(RectExtensions.CreateCenterRect(item, Vector2.zero)); }
static public Rect GetSizedAnchorCenter(this Rect item, Vector2 size) { return(RectExtensions.CreateCenterRect(item.center, size)); }
static public void SetPixelSizeCentered(this Camera item, Vector2 size) { item.pixelRect = RectExtensions.CreateCenterRect(ScreenExtensions.GetCenter(), size); }
static public Rect GetLocalRect(this BoxCollider2D item) { return(RectExtensions.CreateCenterRect(item.offset, item.size)); }
static public Rect GetSpriteSpaceRect(this Sprite item) { return(RectExtensions.CreateCenterRect(Vector2.zero, item.GetTextureSize())); }