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