예제 #1
0
        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));
        }
예제 #2
0
 static public void DrawCenterRect(Vector2 center, Vector2 size)
 {
     GUI.DrawTexture(
         RectExtensions.CreateCenterRect(center, size),
         GetWhitePixelTexture()
         );
 }
예제 #3
0
 static public Rect GetWorldRect(this BoxCollider2D item)
 {
     return(RectExtensions.CreateCenterRect(
                item.transform.TransformPoint(item.offset),
                item.transform.TransformVector(item.size)
                ));
 }
예제 #4
0
        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);
        }
예제 #5
0
 public Rect GetRect()
 {
     return(RectExtensions.CreateCenterRect(this.GetPlanarPosition(), size));
 }
예제 #6
0
 static public Rect GetRect(this Vector2 item)
 {
     return(RectExtensions.CreateCenterRect(item, Vector2.zero));
 }
예제 #7
0
 static public Rect GetSizedAnchorCenter(this Rect item, Vector2 size)
 {
     return(RectExtensions.CreateCenterRect(item.center, size));
 }
예제 #8
0
 static public void SetPixelSizeCentered(this Camera item, Vector2 size)
 {
     item.pixelRect = RectExtensions.CreateCenterRect(ScreenExtensions.GetCenter(), size);
 }
예제 #9
0
 static public Rect GetLocalRect(this BoxCollider2D item)
 {
     return(RectExtensions.CreateCenterRect(item.offset, item.size));
 }
예제 #10
0
 static public Rect GetSpriteSpaceRect(this Sprite item)
 {
     return(RectExtensions.CreateCenterRect(Vector2.zero, item.GetTextureSize()));
 }