示例#1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 temp = this.transform.position;

        switch (position)
        {
        case legPos.TopLeft:
            temp.x = p.GetStart().x - 0.35f;
            temp.y = p.GetStop().y - 0.65f;
            break;

        case legPos.TopRight:
            temp.x = p.GetStop().x - 0.65f;
            temp.y = p.GetStop().y - 0.65f;
            break;

        case legPos.BottomLeft:
            temp.x = p.GetStart().x - 0.35f;
            temp.y = p.GetStart().y - 0.35f;
            break;

        case legPos.BottomRight:
            temp.x = p.GetStop().x - 0.65f;
            temp.y = p.GetStart().y - 0.35f;
            break;
        }

        this.transform.position = temp;
    }
示例#2
0
 public Vector2 ResetPosition(IResizable p)
 {
     return(new Vector2(
                p.GetStart().x,
                (p.GetStart().y + p.GetStop().y) / 2f)
            + new Vector2(-0.5f, -0.5f));
 }
示例#3
0
 public Vector2 ResetPosition(IResizable p)
 {
     return new Vector2(
         p.GetStop().x,
         p.GetStart().y)
         + new Vector2(-0.5f,-0.5f);
 }
示例#4
0
    public void SetParent(IResizable p, Vector2 pos)
    {
        Vector2 wh2 = (p.GetStart() - p.GetStop()) / new Vector2(2.0f, 2.0f);

        p.SetStart(pos - wh2);
        p.SetStop(pos + wh2);
    }
示例#5
0
 public Vector2 ResetPosition(IResizable p)
 {
     return(p.GetStart() + new Vector2(-0.5f, -0.5f));
 }