Ejemplo n.º 1
0
    void Start()
    {
        camera2d = GameObject.Find("Camera2d").GetComponent <Camera> ();
        VectorLine.SetCanvasCamera(camera2d);
        VectorLine.canvas3D.sortingLayerName = "World";

        gridLine = new VectorLine("Grid", new Vector2[0], null, 1.0f);
        drawLine = new VectorLine("DrawLine", new Vector3[0], null, 1.0f, isContinue? LineType.Continuous : LineType.Discrete, isContinue ? Joins.None : Joins.None);
        //drawLine.rectTransform.gameObject.AddComponent<Outline>();
        rulerLine      = new VectorLine("Ruler", new Vector3[0], null, 1.0f, LineType.Discrete);
        segmentOutline = new VectorLine("SegmentOutline", new Vector3[0], null, 1.0f, LineType.Discrete);
        segmentFill    = new WallFill(VectorLine.canvas3D, "SegmentFill");

        Vector2[] room = RoomQuad.GetVertex();
        //DrawWall(room);
        List <Wall2D> roomWalls = DrawHelper.ContinueToDiscrete(room);

        Home.Get().AddWallList(roomWalls);

//		VectorLine testLine = new VectorLine("test", new Vector3[] { Vector3.zero, new Vector3(1.0f, 0f, 0f), Vector3.one }, null, 2.0f, LineType.Continuous);
//		testLine.Draw3D();

        // Align 1-pixel lines on the pixel grid, so they don't potentially get messed up by anti-aliasing
        //gridLine.rectTransform.anchoredPosition = new Vector2 (.5f, .5f);
        gridLine.rectTransform.anchoredPosition = new Vector2(0f, 0f);
        //MakeGrid ();

        //SetScale(DrawHelper.unitPixels);
        DrawHelper.OnScaleChanged = MakeGrid2;
        DrawHelper.SetScale(camera2d, DrawHelper.unitPixels);

        mState = State2D.Idle;
    }