Exemplo n.º 1
0
    public void AddGizmoCorner(Gizmo gizmo)
    {
        if (!(gizmo is GizmoCorner))
        {
            return;
        }
        GizmoCorner gizmoCorner = (GizmoCorner)gizmo;

        GameObject gizmoObject = new GameObject("corner");

        gizmoObject.transform.SetParent(gizmoWrapper.transform);

        CornerBehavior cornerBehavior = gizmoObject.AddComponent <CornerBehavior>();

        cornerBehavior.Init(geoCamera);

        CornerRefer corner = gizmoCorner.corner;
        Vector3     origin = geometry.UnitVector(corner.id2);
        Vector3     dir1   = geometry.Direction(corner.id2, corner.id1);
        Vector3     dir2   = geometry.Direction(corner.id2, corner.id3);

        cornerBehavior.SetData(origin, dir1, dir2);

        gizmoMap.Add(gizmoCorner, cornerBehavior);
    }
Exemplo n.º 2
0
    public BottomAngleCondition(int id1, int id2, int id3, float angle) : base(2)
    {
        this.corner = new CornerRefer(id1, id2, id3);
        this.angle  = angle;

        GizmoCorner gizmoCorner = new GizmoCorner(corner);
        GizmoAngle  gizmoAngle  = new GizmoAngle(corner);

        gizmos = new Gizmo[] { gizmoCorner, gizmoAngle };
    }
Exemplo n.º 3
0
    public void RemoveGizmoCorner(Gizmo gizmo)
    {
        if (!(gizmo is GizmoCorner))
        {
            return;
        }
        GizmoCorner gizmoCorner = (GizmoCorner)gizmo;

        CornerBehavior cornerBehavior = (CornerBehavior)gizmoMap[gizmoCorner];

        Destroy(cornerBehavior.gameObject);

        gizmoMap.Remove(gizmoCorner);
    }
Exemplo n.º 4
0
    public override void InitWithGeometry(Geometry geometry)
    {
        VertexUnit v1 = geometry.VertexUnit(corner.id1);
        VertexUnit v2 = geometry.VertexUnit(corner.id2);
        VertexUnit v3 = geometry.VertexUnit(corner.id3);

        dependencies = new List <VertexUnit>();
        dependencies.Add(v1);
        dependencies.Add(v2);
        dependencies.Add(v3);

        GizmoCorner gizmoCorner = new GizmoCorner(corner);
        GizmoAngle  gizmoAngle  = new GizmoAngle(corner);

        gizmos = new Gizmo[] { gizmoCorner, gizmoAngle };
    }
Exemplo n.º 5
0
    public void UpdateGizmoCorner(Gizmo gizmo)
    {
        if (!(gizmo is GizmoCorner))
        {
            return;
        }
        GizmoCorner gizmoCorner = (GizmoCorner)gizmo;

        CornerBehavior cornerBehavior = (CornerBehavior)gizmoMap[gizmoCorner];

        CornerRefer corner = gizmoCorner.corner;
        Vector3     origin = geometry.UnitVector(corner.id2);
        Vector3     dir1   = geometry.Direction(corner.id2, corner.id1);
        Vector3     dir2   = geometry.Direction(corner.id2, corner.id3);

        cornerBehavior.SetData(origin, dir1, dir2);
    }