예제 #1
0
파일: LayerRect.cs 프로젝트: pb0/ID0_Test
    public LayerRect(LayerPoint point, float width, float height, WorldAnchor anchor)
    {
        this.point = point;
        this.width = width;
        this.height = height;
        this.anchor = anchor;

        CalcCornerPoints(out TopLeft, out BottomRight);
        Rect = RectTool.Create(TopLeft.InLayerPoint, BottomRight.InLayerPoint);
    }
예제 #2
0
파일: LayerRect.cs 프로젝트: pb0/ID0_Test
    private void CalcCornerPoints(out LayerPoint topLeft, out LayerPoint bottomRight)
    {
        // anchor to TopLeft
        float topLeftOffsetX = 0;
        float topLeftOffsetY = 0;
        float bottomRightOffsetX = 0;
        float bottomRightOffsetY = 0;

        if (anchor == WorldAnchor.BottomLeft || anchor == WorldAnchor.MiddleLeft || anchor == WorldAnchor.TopLeft)
        {
            topLeftOffsetX = 0;
            bottomRightOffsetX = width;
        }
        if (anchor == WorldAnchor.BottomCenter || anchor == WorldAnchor.MiddleCenter || anchor == WorldAnchor.TopCenter)
        {
            topLeftOffsetX = -width / 2;
            bottomRightOffsetX = width / 2;
        }
        if (anchor == WorldAnchor.BottomRight || anchor == WorldAnchor.MiddleRight || anchor == WorldAnchor.TopRight)
        {
            topLeftOffsetX = -width;
            bottomRightOffsetX = 0;
        }

        if (anchor == WorldAnchor.BottomLeft || anchor == WorldAnchor.BottomCenter || anchor == WorldAnchor.BottomRight)
        {
            topLeftOffsetY = height;
            bottomRightOffsetY = 0;
        }
        if (anchor == WorldAnchor.MiddleLeft || anchor == WorldAnchor.MiddleCenter || anchor == WorldAnchor.MiddleRight)
        {
            topLeftOffsetY = height / 2;
            bottomRightOffsetY = -height / 2;
        }
        if (anchor == WorldAnchor.TopLeft || anchor == WorldAnchor.TopCenter || anchor == WorldAnchor.TopRight)
        {
            topLeftOffsetY = 0;
            bottomRightOffsetY = -height;
        }

        topLeft = new LayerPoint(point, new Vector3(topLeftOffsetX, topLeftOffsetY));
        bottomRight = new LayerPoint(point, new Vector3(bottomRightOffsetX, bottomRightOffsetY));
    }
예제 #3
0
파일: Layer.cs 프로젝트: pb0/ID0_Test
 public Vector3 LayerToScreenPoint(Vector3 position)
 {
     LayerPoint point = new LayerPoint(this, position);
     return point.InScreenPoint;
 }
예제 #4
0
파일: LayerPoint.cs 프로젝트: pb0/ID0_Test
 public LayerPoint(LayerPoint point, Vector2 offset)
 {
     this.layer = point.layer;
     this.layerPoint = point.layerPoint + offset;
 }