示例#1
0
    void Start()
    {
        //VectorLine.SetEndCap ("Arrow4", EndCap.Both, 0, 0, 2.0f, 1.0f, lineTex, frontTex);
        line           = new VectorLine("Line", linePoints, f_LineWidth, LineType.Discrete);
        line2          = new VectorLine("Line2", line2Points, f_LineWidth, LineType.Discrete);
        line.collider  = true;
        line2.collider = true;
        line.Draw3DAuto();
        line2.Draw3DAuto();
        line.rectTransform.gameObject.tag  = "CasualLine";
        line2.rectTransform.gameObject.tag = "CasualLine";
        lineScript                    = line.rectTransform.gameObject.AddComponent <IE_Line>();
        lineScript.f_Time             = f_CasualLineLifeTime;
        lineScript.f_InterpolateSpeed = f_CasualLineDestroySpeed;
        //lineScript.f_ColliderY = f_ColliderY;
        //  lineScript.f_MinColliderX = f_MinColliderX;
        lineScript2                    = line2.rectTransform.gameObject.AddComponent <IE_Line>();
        lineScript2.f_Time             = f_CasualLineLifeTime;
        lineScript2.f_InterpolateSpeed = f_CasualLineDestroySpeed;
        // lineScript2.f_ColliderY = f_ColliderY;
        //  lineScript2.f_MinColliderX = f_MinColliderX;

        linePoints.Add(new Vector3());
        linePoints.Add(new Vector3());
        linePoints.Add(new Vector3());
        linePoints.Add(new Vector3());
        line2Points.Add(new Vector3());
        line2Points.Add(new Vector3());
        line2Points.Add(new Vector3());
        line2Points.Add(new Vector3());
    }
示例#2
0
    void Start()
    {
        numberOfLines = Mathf.Clamp(numberOfLines, 2, 8190);
        var points = new List <Vector3>();

        // Lines down X axis
        for (int i = 0; i < numberOfLines; i++)
        {
            points.Add(new Vector3(i * distanceBetweenLines, 0, 0));
            points.Add(new Vector3(i * distanceBetweenLines, 0, (numberOfLines - 1) * distanceBetweenLines));
        }
        // Lines down Z axis
        for (int i = 0; i < numberOfLines; i++)
        {
            points.Add(new Vector3(0, 0, i * distanceBetweenLines));
            points.Add(new Vector3((numberOfLines - 1) * distanceBetweenLines, 0, i * distanceBetweenLines));
        }
        var line = new VectorLine("Grid", points, lineWidth);

        line.Draw3DAuto();

        // Move camera X position to middle of grid
        var pos = transform.position;

        pos.x = ((numberOfLines - 1) * distanceBetweenLines) / 2;
        transform.position = pos;
    }
示例#3
0
    void Start()
    {
        deformedLineList = new List <VectorLine>();
        pointLists       = new List <List <Vector3> >();
        VectorLine.SetCamera3D(myCamera);
        //Wireframe of cube
        VectorLine line = new VectorLine("Wireframe", new List <Vector3>(), 1.0f, LineType.Discrete);

        Mesh cubeMesh = ((MeshFilter)gameObject.GetComponent("MeshFilter")).mesh;

        line.MakeWireframe(cubeMesh);
        line.drawTransform = gameObject.transform;
        line.Draw3DAuto();

        mainLine = new VectorLine("MainLine", new List <Vector3>(), 10.0f);
        mainLine.Draw3DAuto();

        deformedLine = new VectorLine("deformedLine", new List <Vector3>(), 10.0f);
        deformedLine.Draw3DAuto();

        lineTransformList         = new List <Transform>();
        deformedLineTransformList = new List <Transform>();

        //Force Line
        forceVectorList = new List <Vector3>();
        //forceLine = new VectorLine("ForceLine", new List<Vector3>(), 30.0f);
        //VectorLine.SetEndCap("Arrow", EndCap.Both, -1.0F, lineTex, frontTex, backTex);
        //forceLine.endCap = "Arrow";
        //forceLine.Draw3DAuto();
    }
示例#4
0
    private void SetupLines()
    {
        aimMinLine = new VectorLine("Line: Min aim limit", new List <Vector3>(64), 1);
        aimMinLine.Draw3DAuto();

        aimMaxLine = new VectorLine("Line: Max aim limit", new List <Vector3>(64), 1);
        aimMaxLine.Draw3DAuto();

        moveTriggerLine = new VectorLine("Line: Move trigger", new List <Vector3>(64), 1);
        moveTriggerLine.Draw3DAuto();


        aimLine = new VectorLine("Line: Aim", new List <Vector3>(), aimWidth);
        aimLine.points3.Add(transform.position + Vector3.up);
        aimLine.points3.Add(transform.position + Vector3.up);
        aimLine.color = aimColour;
        aimLine.Draw3DAuto();

        moveLine = new VectorLine("Line: Move", new List <Vector3>(), aimWidth);
        moveLine.points3.Add(transform.position + Vector3.up);
        moveLine.points3.Add(transform.position + Vector3.up);
        moveLine.color = moveColour;
        moveLine.Draw3DAuto();

        currentMoveLine = new VectorLine("Line: Current Move", new List <Vector3>(), aimWidth * 3f);
        currentMoveLine.points3.Add(transform.position + Vector3.up);
        currentMoveLine.points3.Add(transform.position + Vector3.up);
        currentMoveLine.points3.Add(transform.position + Vector3.up);
        currentMoveLine.color    = Color.yellow;
        currentMoveLine.lineType = LineType.Continuous;
        currentMoveLine.SetWidth(aimWidth * 3f, 0);
        currentMoveLine.SetWidth(aimWidth, 1);
        currentMoveLine.Draw3DAuto();
    }
示例#5
0
 /// <summary>
 ///   Prepare a vector line for our use-case.
 /// </summary>
 /// <param name="line">
 ///   The line to set up.
 /// </param>
 private void SetupLine(VectorLine line, List <Color32> colors)
 {
     line.material      = _material;
     line.drawTransform = transform;
     line.SetColors(colors);
     line.Draw3DAuto();
 }
示例#6
0
 /// <summary>
 ///   Prepare a vector line for our use-case.
 /// </summary>
 /// <param name="line">
 ///   The line to set up.
 /// </param>
 private void SetupLine(VectorLine line)
 {
     line.material      = _material;
     line.color         = _color;
     line.drawTransform = transform;
     line.Draw3DAuto();
 }
示例#7
0
    // Use this for initialization
    void Start()
    {
        // shader init


        InitShader();


        gos = new GameObject[count];
        for (int i = 0; i < count; i++)
        {
            gos[i] = Instantiate <GameObject>(inst);
            gos[i].transform.parent = this.gameObject.transform;
        }


        //    RunShader();
        linePoints = new List <Vector3>();// { new Vector3(20, 30), new Vector2(100, 50) };

        // VECTROSITY LINE DRAWING

        line = new VectorLine("VectroLine", linePoints, 2f, LineType.Discrete);
        line.points3.Add(new Vector3(0, 0, 0));
        line.points3.Add(new Vector3(5, 2, 3));
        line.drawTransform = this.gameObject.transform;
        line.Draw3DAuto();

        for (int j = 0; j < edgesData.Length; j++)
        {
            linePoints.Add(new Vector3(0, 0, 0));
        }
    }
示例#8
0
    private static GameObject DrawHemisphereLines(GameObject hemisphere, string layerName)
    {
        GameObject Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);

        GameObject.Destroy(Sphere.GetComponent <Collider>());
        Sphere.transform.position   = hemisphere.transform.position;
        Sphere.transform.localScale = hemisphere.transform.lossyScale;
        VectorLine hemisphereLine = new VectorLine("NewHemiLine", new List <Vector3>(), 2.0f, LineType.Discrete);
        GameObject VectorLineObj  = GameObject.Find("NewHemiLine");

        hemisphereLine.Draw3DAuto();

        List <GameObject> childList = createChildSpheres(Sphere, hemisphere, layerName, Sphere.transform.localScale.x / 2);

        foreach (GameObject childSphere in childList)
        {
            hemisphereLine.points3.Add(Sphere.transform.position);
            hemisphereLine.points3.Add(childSphere.transform.position);
        }
        hemisphereLine.color = Color.green;
        //VectorLine line = new VectorLine("Wireframe", new List<Vector3>(), 1.0f, LineType.Discrete);
        //line.MakeWireframe(((MeshFilter)hemisphere.GetComponent("MeshFilter")).mesh);
        //line.drawTransform = hemisphere.transform;
        //line.Draw3DAuto();
        Sphere.SetActive(false);
        return(VectorLineObj);
    }
示例#9
0
    private void Start()
    {
        VectorLine vectorLine = new VectorLine("OrbitLine", new List <Vector3>(this.orbitLineResolution), 2f, (LineType)0);

        vectorLine.set_material(this.lineMaterial);
        vectorLine.MakeCircle(Vector3.get_zero(), Vector3.get_up(), Vector3.Distance(((Component)this).get_transform().get_position(), Vector3.get_zero()));
        vectorLine.Draw3DAuto();
    }
示例#10
0
    public Material lineMaterial;       // This should be a material with a shader that will draw on top of the stars

    void Start()
    {
        var orbitLine = new VectorLine("OrbitLine", new List <Vector3>(orbitLineResolution), 2.0f, LineType.Continuous);

        orbitLine.material = lineMaterial;
        orbitLine.MakeCircle(Vector3.zero, Vector3.up, Vector3.Distance(transform.position, Vector3.zero));
        orbitLine.Draw3DAuto();
    }
    // Token: 0x06000B35 RID: 2869 RVA: 0x00032F28 File Offset: 0x00031328
    private void Start()
    {
        VectorLine vectorLine = new VectorLine("OrbitLine", new List <Vector3>(this.orbitLineResolution), 2f, LineType.Continuous);

        vectorLine.material = this.lineMaterial;
        vectorLine.MakeCircle(Vector3.zero, Vector3.up, Vector3.Distance(base.transform.position, Vector3.zero));
        vectorLine.Draw3DAuto();
    }
示例#12
0
 private void Draw3DLine(VectorLine line)
 {
     if (LocationHistoryManager.Instance.LineSetting.IsAuto)
     {
         line.Draw3DAuto();//点线多了 确实会影响性能
     }
     else
     {
         line.Draw3D();
     }
 }
示例#13
0
 void Start()
 {
     preview.SetActive(false); //disable until we need it
     gridGranularity = (float)(1m / 20m);
     originSet       = false;
     isColliding     = false;
     allowPlacing    = false;
     delLine         = new VectorLine("Delete", new List <Vector3>(), 6.0f, LineType.Discrete);
     VectorLine.SetCamera3D(myCamera);
     delLine.Draw3DAuto();
 }
示例#14
0
    public string AddLine(Vector3 p0, Vector3 p1)
    {
        string tag = "Line " + NextID++;

        Vector3[]  points = new Vector3[] { p0, p1 };
        VectorLine line   = new VectorLine(tag, points, DefaultLineColor, null, DefaultLineWidth);

        line.Draw3DAuto();
        _lines.Add(tag, line);

        return(tag);
    }
示例#15
0
 void createLines()
 {
     Vector3[] v3;
     v3 = new Vector3[720];
     selectCircle = new VectorLine("Select Circle", v3, null, line_thickness);
     selectCircle.Draw3DAuto();
     destinationCircle = new VectorLine("Destination Circle", v3, null, line_thickness);
     destinationCircle.Draw3DAuto();
     movePathLine = new VectorLine("Move Path Line", lineList, null, line_thickness, LineType.Continuous);
     movePathLine.Draw3DAuto();
     VectorLine.canvas3D.sortingLayerName = "Select Circles";
 }
示例#16
0
 void createLines()
 {
     Vector3[] v3;
     v3           = new Vector3[720];
     selectCircle = new VectorLine("Select Circle", v3, null, line_thickness);
     selectCircle.Draw3DAuto();
     destinationCircle = new VectorLine("Destination Circle", v3, null, line_thickness);
     destinationCircle.Draw3DAuto();
     movePathLine = new VectorLine("Move Path Line", lineList, null, line_thickness, LineType.Continuous);
     movePathLine.Draw3DAuto();
     VectorLine.canvas3D.sortingLayerName = "Select Circles";
 }
示例#17
0
        private void CreateBorder()
        {
            Transform drawTransform = m_legendMesh.transform;

            m_border = new VectorLine("LegendBorderLine", new List <Vector3>(2), ParentScript.LineMaterial, BorderWidth, LineType.Continuous)
            {
                color         = BorderColor,
                drawTransform = drawTransform,
                layer         = OrderInLayer
            };

            m_border.Draw3DAuto();
        }
示例#18
0
    // Start is called before the first frame update
    void Start()
    {
        lineTrans = transform;

        var lines = new List <Vector3>()
        {
            new Vector3(0.1f, -0.1f, 0.1f), new Vector3(0.17f, 0.589f, 0.17f), new Vector3(0.17f, 0.589f, 0.17f), new Vector3(-0.17f, 0.589f, 0.17f), new Vector3(-0.17f, 0.589f, 0.17f), new Vector3(-0.1f, -0.1f, 0.1f), new Vector3(-0.1f, -0.1f, 0.1f), new Vector3(0.1f, -0.1f, 0.1f), new Vector3(0.002f, 0.786f, 0.002f), new Vector3(0.002f, 0.786f, -0.002f), new Vector3(0.002f, 0.786f, -0.002f), new Vector3(-0.002f, 0.786f, -0.002f), new Vector3(-0.002f, 0.786f, -0.002f), new Vector3(0.002f, 0.786f, 0.002f), new Vector3(-0.002f, 0.786f, -0.002f), new Vector3(-0.002f, 0.786f, 0.002f), new Vector3(-0.002f, 0.786f, 0.002f), new Vector3(0.002f, 0.786f, 0.002f), new Vector3(0.17f, 0.589f, -0.17f), new Vector3(0.1f, -0.1f, -0.1f), new Vector3(0.1f, -0.1f, -0.1f), new Vector3(-0.1f, -0.1f, -0.1f), new Vector3(-0.1f, -0.1f, -0.1f), new Vector3(0.17f, 0.589f, -0.17f), new Vector3(-0.1f, -0.1f, -0.1f), new Vector3(-0.17f, 0.589f, -0.17f), new Vector3(-0.17f, 0.589f, -0.17f), new Vector3(0.17f, 0.589f, -0.17f), new Vector3(0.1f, -0.1f, -0.1f), new Vector3(0.1f, -0.1f, 0.1f), new Vector3(-0.1f, -0.1f, 0.1f), new Vector3(0.1f, -0.1f, -0.1f), new Vector3(-0.1f, -0.1f, 0.1f), new Vector3(-0.1f, -0.1f, -0.1f), new Vector3(-0.17f, 0.589f, 0.17f), new Vector3(-0.17f, 0.589f, -0.17f), new Vector3(-0.17f, 0.589f, -0.17f), new Vector3(-0.1f, -0.1f, 0.1f), new Vector3(0.17f, 0.589f, -0.17f), new Vector3(0.17f, 0.589f, 0.17f), new Vector3(0.17f, 0.589f, 0.17f), new Vector3(0.049f, 0.744f, 0.049f), new Vector3(0.049f, 0.744f, 0.049f), new Vector3(-0.049f, 0.744f, 0.049f), new Vector3(-0.049f, 0.744f, 0.049f), new Vector3(0.17f, 0.589f, 0.17f), new Vector3(-0.049f, 0.744f, 0.049f), new Vector3(-0.17f, 0.589f, 0.17f), new Vector3(-0.049f, 0.744f, 0.049f), new Vector3(-0.049f, 0.744f, -0.049f), new Vector3(-0.049f, 0.744f, -0.049f), new Vector3(-0.17f, 0.589f, 0.17f), new Vector3(-0.049f, 0.744f, -0.049f), new Vector3(-0.17f, 0.589f, -0.17f), new Vector3(-0.049f, 0.744f, -0.049f), new Vector3(0.049f, 0.744f, -0.049f), new Vector3(0.049f, 0.744f, -0.049f), new Vector3(-0.17f, 0.589f, -0.17f), new Vector3(0.049f, 0.744f, -0.049f), new Vector3(0.17f, 0.589f, -0.17f), new Vector3(0.049f, 0.744f, -0.049f), new Vector3(0.049f, 0.744f, 0.049f), new Vector3(0.049f, 0.744f, 0.049f), new Vector3(0.17f, 0.589f, -0.17f), new Vector3(0.049f, 0.744f, 0.049f), new Vector3(0.002f, 0.786f, 0.002f), new Vector3(-0.002f, 0.786f, 0.002f), new Vector3(0.049f, 0.744f, 0.049f), new Vector3(-0.002f, 0.786f, 0.002f), new Vector3(-0.049f, 0.744f, 0.049f), new Vector3(-0.002f, 0.786f, -0.002f), new Vector3(-0.049f, 0.744f, 0.049f), new Vector3(-0.002f, 0.786f, -0.002f), new Vector3(-0.049f, 0.744f, -0.049f), new Vector3(0.002f, 0.786f, -0.002f), new Vector3(-0.049f, 0.744f, -0.049f), new Vector3(0.002f, 0.786f, -0.002f), new Vector3(0.049f, 0.744f, -0.049f), new Vector3(0.002f, 0.786f, 0.002f), new Vector3(0.049f, 0.744f, -0.049f)
        };

        line = new VectorLine("Crystal", lines, 3.0f, LineType.Discrete, Joins.Weld);
        line.drawTransform   = transform;
        lineTrans.localScale = new Vector3(1.1f, 1.1f, 1.1f);


        line.Draw3DAuto();
    }
示例#19
0
        public DataLine(GraphLines parent, Guid id, int index)
        {
            m_id    = id;
            m_index = index;

            m_unscaledData = new float[parent.m_pointsInLine];

            m_vector               = new VectorLine("DataLine" + index, new Vector3[parent.m_pointsInLine], parent.m_lineMaterial, parent.m_lineWidth, LineType.Continuous);
            m_vector.color         = parent.m_lineColors[index % parent.m_lineColors.Length];
            m_vector.drawTransform = parent.m_target;
            m_vector.Draw3DAuto();

            for (int x = 0; x < m_vector.points3.Count; x++)
            {
                m_unscaledData[x]   = float.NaN;
                m_vector.points3[x] = new Vector3(Mathf.Lerp(-5.0F, 5.0F, x / (float)m_vector.points3.Count), -((index + 1) * parent.m_lineDepthOffset + 0.05F), 0.0F);
            }
        }
示例#20
0
        public DataLine(GraphLines parent, Guid id, int index)
        {
            ID           = id;
            Index        = index;
            LinePoints   = new Vector3[parent.PointsInLine];
            UnscaledData = new float[LinePoints.Length];

            int vectorCapacity;

            if (parent.UseSplineGraph)
            {
                int segmentFactor = parent.SplineSegmentFactor;

                if (segmentFactor < 1)
                {
                    segmentFactor = 1;
                }

                m_segmentCount = LinePoints.Length * segmentFactor;
                vectorCapacity = m_segmentCount + 1;
            }
            else
            {
                vectorCapacity = LinePoints.Length;
            }

            m_vector = new VectorLine($"DataLine{index}", new List <Vector3>(vectorCapacity), parent.LineMaterial, parent.LineWidth, parent.GraphPoints ? LineType.Points : LineType.Continuous)
            {
                color         = parent.LineColors[index % parent.LineColors.Length],
                drawTransform = parent.Target
            };

            m_vector.Draw3DAuto();

            float zOffset = -((index + 1) * parent.LineDepthOffset + 0.05F);

            for (int x = 0; x < LinePoints.Length; x++)
            {
                UnscaledData[x] = float.NaN;
                LinePoints[x]   = new Vector3(Mathf.Lerp(-5.0F, 5.0F, x / (float)LinePoints.Length), zOffset, 0.0F); // y and z axes intentionally transposed
            }

            m_parent = parent;
        }
示例#21
0
    void Start()
    {
        VectorLine.SetCamera3D(myCamera);
        demoLine = new VectorLine("demoLine", new List <Vector3>(), 20.0f, LineType.Discrete);
        Hemisphere.CreateHemisphereMesh();
        demoLine.points3.Add(target1.transform.position);
        demoLine.points3.Add(pos.transform.position);
        demoLine.points3.Add(target2.transform.position);
        demoLine.points3.Add(pos.transform.position);
        demoLine.Draw3DAuto();

        origin = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        origin.transform.position = pos.transform.position;
        Destroy(origin.GetComponent <MeshRenderer>());

        freedomPos = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        freedomPos.transform.localScale = new Vector3(0.01F, 0.01F, 0.01F);
        Destroy(freedomPos.GetComponent <MeshRenderer>());
    }
示例#22
0
        public LegendLine(GraphLines parent, Guid id, int index, Color color)
        {
            Transform transform = parent.m_legendMesh.transform;
            Vector3   position  = transform.position;

            m_id                   = id;
            m_vector               = new VectorLine("LegendLine" + index, new Vector3[2], parent.m_lineMaterial, parent.m_lineWidth, LineType.Discrete);
            m_vector.color         = color;
            m_vector.drawTransform = transform;
            m_vector.Draw3DAuto();

            float spacing = parent.m_legendMesh.characterSize * 1.5F;

            // Position legend line relative to text descriptions
            Vector3 point1 = new Vector3(-2.0F, -(spacing / 2.0F + index * spacing), -position.z);
            Vector3 point2 = new Vector3(-0.5F, point1.y, point1.z);

            m_vector.points3[0] = point1;
            m_vector.points3[1] = point2;
        }
示例#23
0
    // Use this for initialization
    void Start()
    {
        VectorManager.useDraw3D = true;

        var pos3d = transf.Select(x => x.position).ToList();
        var pos2d = pos3d.Select(x => new Vector2(x.x, x.y)).ToList();

        //draw 2d
        vobj.vectorLine.Resize(pos2d.Count + 1);
        vobj.vectorLine.points2 = pos2d;
        vobj.vectorLine.points3 = pos3d;
        vobj.vectorLine.Draw();

        //draw 3d
        var vl = new VectorLine("a", pos3d, 100f);

        vobj3d.SetVectorLine(vl, vobj.texture, mat);
        vl.points3.ForEach(x => Debug.Log(x));
        vl.Draw3DAuto();
    }
    // Token: 0x06000B1B RID: 2843 RVA: 0x00031F4C File Offset: 0x0003034C
    private void Start()
    {
        this.numberOfLines = Mathf.Clamp(this.numberOfLines, 2, 8190);
        List <Vector3> list = new List <Vector3>();

        for (int i = 0; i < this.numberOfLines; i++)
        {
            list.Add(new Vector3((float)i * this.distanceBetweenLines, 0f, 0f));
            list.Add(new Vector3((float)i * this.distanceBetweenLines, 0f, (float)(this.numberOfLines - 1) * this.distanceBetweenLines));
        }
        for (int j = 0; j < this.numberOfLines; j++)
        {
            list.Add(new Vector3(0f, 0f, (float)j * this.distanceBetweenLines));
            list.Add(new Vector3((float)(this.numberOfLines - 1) * this.distanceBetweenLines, 0f, (float)j * this.distanceBetweenLines));
        }
        VectorLine vectorLine = new VectorLine("Grid", list, this.lineWidth);

        vectorLine.Draw3DAuto();
        Vector3 position = base.transform.position;

        position.x = (float)(this.numberOfLines - 1) * this.distanceBetweenLines / 2f;
        base.transform.position = position;
    }
示例#25
0
    void SwitchToConstraintMode(GameObject intermediatePoint, GameObject target)
    {
        /*
         * 1. Disable switcher
         * 2. Turn Down light
         * 3. Spawn Plane w/ correct material & attach it
         * 4. switch to constraint mode
         * 5. Initialize dottedLine
         */
        LeftRadialMenu.SetActive(false);
        lightObj.SetActive(false);
        Vector3 size = domain.transform.lossyScale * 2;

        size.z = size.z / 10000;
        intermediatePoint.GetComponent <IntermediateInfo>().SpawnPlane(target, size);
        dottedLine = new VectorLine("NewLine", new List <Vector3>(), dottedTexture, 8.0f);
        dottedLine.points3.Add(intermediatePoint.transform.position);
        dottedLine.points3.Add(intermediatePoint.transform.position);
        dottedLine.Draw3DAuto();
        freedomLineObj = GameObject.Find("NewLine");
        constraintMode = true;
        numConstraints = 0;
    }
示例#26
0
文件: GraphLines.cs 项目: rmc00/gsf
        public LegendLine(GraphLines parent, Guid id, int index, Color color)
        {
            Transform transform = parent.m_legendMesh.transform;
            Vector3 position = transform.position;

            m_id = id;
            m_vector = new VectorLine("LegendLine" + index, new Vector3[2], parent.m_lineMaterial, parent.m_lineWidth, LineType.Discrete);
            m_vector.color = color;
            m_vector.drawTransform = transform;
            m_vector.Draw3DAuto();

            float spacing = parent.m_legendMesh.characterSize * 1.5F;

            // Position legend line relative to text descriptions
            Vector3 point1 = new Vector3(-2.0F, -(spacing / 2.0F + index * spacing), -position.z);
            Vector3 point2 = new Vector3(-0.5F, point1.y, point1.z);

            m_vector.points3[0] = point1;
            m_vector.points3[1] = point2;
        }
示例#27
0
    public void removeFrontNode()
    {
        color_list.RemoveAt(0);
        width_list.RemoveAt(0);
        Vector3[] new_points = new Vector3[path_line.points3.Length -1];
        for(int i = 0; i < new_points.Length - 1; ++i)
        {
            new_points[i] = path_line.points3[i+1];
        }

        VectorLine.Destroy(ref path_line);
        path_line = new VectorLine("path", new_points, null, 5F ,LineType.Continuous,Joins.Weld);
        path_line.SetColorsSmooth(color_list.ToArray());
        path_line.SetWidths(width_list.ToArray());
        path_line.Draw3DAuto();

        VectorLine del_spot = spot_list[0];
        spot_list.RemoveAt(0);
        VectorLine.Destroy(ref del_spot);
    }
示例#28
0
文件: RayTest.cs 项目: wHo2/TMC
    public void Link(GameObject crystal)
    {
        if (crystal != null)//水晶连线   && linkStop == false
        {
            if (!draw)//如果还没开始画线
            {
                //if (EnergyManager.Instance.accessibleEnergy > 0)
                {
                    #region
                    float x = 0, z = 0; int kx = -1, ky = -1;
                    linePoints = new Vector3[2];
                    linePoints[0] = crystal.transform.position;
                    z = EnergyManager.Instance.HeroMagicCircle.getz(linePoints[0].z);
                    if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[2])
                        x = EnergyManager.Instance.HeroMagicCircle.getx1(linePoints[0].x);
                    else if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[0] || z == EnergyManager.Instance.HeroMagicCircle.rowKey[4])
                        x = EnergyManager.Instance.HeroMagicCircle.getx2(linePoints[0].x);
                    else
                        x = EnergyManager.Instance.HeroMagicCircle.getx3(linePoints[0].x);
                    kx = EnergyManager.Instance.HeroMagicCircle.getKx(x);
                    ky = EnergyManager.Instance.HeroMagicCircle.getKy(z);
                    if (kx != -1)
                    {
                        l1 = new Point( kx , ky);
                        draw = true;
                        //EnergyManager.Instance.MinusEnergy(1);
                    }
                    screenSpace = Camera.main.WorldToScreenPoint(crystal.transform.position);
                    linePoints[1] = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));
                    temp1 = new VectorLine("3DLine", linePoints, Color.green, lineMaterial, 8.0f);
                    temp2 = new VectorLine("3DLine", linePoints, Color.green, lineMaterial2, 15.0f);
                    temp1.Draw3DAuto();
                    temp2.Draw3DAuto();
                    #endregion
                }
                //else
                //{
                //    //linkStop = true;
                //}
            }
            else
            {
                #region
                float x = 0, z = 0; int kx = -1, ky = -1;
                linePoints[1] = crystal.transform.position;
                z = EnergyManager.Instance.HeroMagicCircle.getz(linePoints[1].z);
                if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[2])
                    x = EnergyManager.Instance.HeroMagicCircle.getx1(linePoints[1].x);
                else if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[0] || z == EnergyManager.Instance.HeroMagicCircle.rowKey[4])
                    x = EnergyManager.Instance.HeroMagicCircle.getx2(linePoints[1].x);
                else
                    x = EnergyManager.Instance.HeroMagicCircle.getx3(linePoints[1].x);
                kx = EnergyManager.Instance.HeroMagicCircle.getKx(x);
                ky = EnergyManager.Instance.HeroMagicCircle.getKy(z);
                l2 = new Point(kx , ky);
                if (l2 == l1)//连自己=>取消连线
                {
                    VectorLine.Destroy(ref temp1);
                    VectorLine.Destroy(ref temp2);
                    //EnergyManager.Instance.MinusEnergy(-1);
                }
                else if (EnergyManager.Instance.HeroMagicCircle.IsOperable(new Line(l1,l2)))
                {
                    if (kx != -1 && !EnergyManager.Instance.HeroMagicCircle.GetLine(l1, l2) && EnergyManager.Instance.HeroMagicCircle.GetLineSwitch(l1.GetX(), l1.GetY(), l2.GetX(), l2.GetY()))//画线
                    {
                        //AddLine(l1, l2);
                        if (EnergyManager.Instance.accessibleEnergy>0)
                        {
                            temp1.Draw3D();
                            temp2.Draw3D();
                            line[l1.GetUni(), l2.GetUni()] = temp1; line2[l1.GetUni(), l2.GetUni()] = temp2;
                            EnergyManager.Instance.HeroMagicCircle.LineTrue(l1.GetUni(), l2.GetUni());
                            EnergyManager.Instance.MinusEnergy(1);
                        }
                        else
                        {
                            VectorLine.Destroy(ref temp1);
                            VectorLine.Destroy(ref temp2);
                            GuideText.Instance.ReturnText("LinkNeedEnergy");
                        }
                    }
                    else if (EnergyManager.Instance.HeroMagicCircle.GetLine(l1, l2))//删线
                    {

                        // Debug.Log("delete");
                        DeleteLine(l1, l2);
                        VectorLine.Destroy(ref temp1);
                        VectorLine.Destroy(ref temp2);
                        GuideText.Instance.GuideLevel(2, 33, "RedundentLink");
                        GuideText.Instance.GuideLevel(3, 33, "RedundentLink");
                        //EnergyManager.Instance.MinusEnergy(-1);
                        //linkStop = true;
                    }
                }
                else
                {
                    GuideText.Instance.ReturnText("NoJumpLink");
                    return;
                }
                draw = false;
                #endregion
            }
        }
    }
示例#29
0
    private void plotDeformedCoords(string str)
    {
        VectorLine.SetCamera3D(myCamera);
        string[]       strArr           = str.Split('|');
        string[]       coords           = strArr[0].Split(';');
        string[]       meshCoords       = strArr[1].Split(';');
        string[]       indices          = strArr[2].Split(' ');
        string[]       meshIndexStrings = strArr[3].Split(';');
        List <Vector3> vectorList       = new List <Vector3>();
        int            numPoints        = coords.Length - 1;
        int            numMesh          = meshCoords.Length - 1;

        print("Number of Points received: " + numPoints);
        print("Number of Mesh Points received: " + numMesh);
        for (int i = 0; i < numPoints; i++) //stop one before because the last one is empty
        {
            Vector3 newCoords = getLocalCoords(coords[i]);
            //Vector3 worldPosNewCoords = domain.transform.TransformPoint(newCoords);
            vectorList.Add(newCoords);

            GameObject newObj = GameObject.Instantiate(allTransformList[i].gameObject, domain.transform);

            List <GameObject> children = new List <GameObject>();
            foreach (Transform child in newObj.transform)
            {
                children.Add(child.gameObject);
            }
            children.ForEach(child => Destroy(child));
            newObj.transform.localScale = allTransformList[i].localScale;
            Color color = ((Renderer)newObj.GetComponent <Renderer>()).material.color;
            color.a = 1F;
            ((Renderer)newObj.GetComponent <Renderer>()).material.color = color;
            newObj.transform.localPosition = newCoords;
            deformedTransformList.Add(newObj.transform);
        }
        //add the mesh coordinates too
        for (int i = 0; i < numMesh; i++)
        {
            //Vector3 worldPosNewCoords = domain.transform.TransformPoint(getLocalCoords(meshCoords[i]));
            vectorList.Add(getLocalCoords(meshCoords[i]));
        }
        //--------------------------------------TODO----------------------------------------------
        //Modify lineTransformList
        //Need to construct a new spline between each node
        //instead of updating every intermediate mesh coord, maybe just make these spline gameObjects children of the main gameObject
        // See if there is too much deviation when scaling / rotating to use this hack

        //for(int i = 0; i < indices.Length - 1; i++)
        //{
        //    domain.GetComponent<InitLines>().deformedLineTransformList.Insert(i, deformedTransformList[int.Parse(indices[i]) - 1]);
        //    domain.GetComponent<InitLines>().deformedLine.points3.Add(deformedTransformList[int.Parse(indices[i]) - 1].position);
        //}

        for (int i = 0; i < meshIndexStrings.Length - 1; i++)
        {
            VectorLine     line            = null;
            GameObject     vectorLineObj   = null;
            List <Vector3> splinePointList = null;
            string[]       currMeshIndices = meshIndexStrings[i].Split(' ');
            splinePointList = new List <Vector3>();
            for (int j = 0; j < currMeshIndices.Length; j++)
            {
                int index = int.Parse(currMeshIndices[j]) - 1;
                splinePointList.Add(vectorList[index]);
            }
            line = new VectorLine("Spline", splinePointList, 10.0f, LineType.Continuous, Joins.Fill);
            line.Draw3DAuto();
            line.SetColor(Color.red);
            vectorLineObj      = GameObject.Find("Spline");
            vectorLineObj.name = "Complete Spline";
            domain.GetComponent <InitLines>().addDeformedLine(line, splinePointList);
        }
    }
示例#30
0
    // Use this for initialization
    void Start()
    {
        frameCount = 10;

        //vertices for bounding box lines
        var vertices       = new Vector3[8];
        var thisMatrix     = box.transform.localToWorldMatrix;
        var storedRotation = box.transform.rotation;

        box.transform.rotation = Quaternion.identity;


        vertices[0] = col.center + new Vector3(col.size.x, col.size.y, col.size.z) * 0.5f;
        vertices[1] = col.center + new Vector3(-col.size.x, col.size.y, col.size.z) * 0.5f;
        vertices[2] = col.center + new Vector3(col.size.x, col.size.y, -col.size.z) * 0.5f;
        vertices[3] = col.center + new Vector3(-col.size.x, col.size.y, -col.size.z) * 0.5f;
        vertices[4] = col.center + new Vector3(col.size.x, -col.size.y, col.size.z) * 0.5f;
        vertices[5] = col.center + new Vector3(-col.size.x, -col.size.y, col.size.z) * 0.5f;
        vertices[6] = col.center + new Vector3(col.size.x, -col.size.y, -col.size.z) * 0.5f;
        vertices[7] = col.center + new Vector3(-col.size.x, -col.size.y, -col.size.z) * 0.5f;


        box.transform.rotation = storedRotation;

        var boxPoints = new List <Vector3> {
            vertices[5],
            vertices[4],
            vertices[1],
            vertices[5],
            vertices[4],
            vertices[0],
            vertices[0],
            vertices[1],
            vertices[3],
            vertices[1],
            vertices[0],
            vertices[2],
            vertices[2],
            vertices[3],
            vertices[7],
            vertices[3],
            vertices[2],
            vertices[6],
            vertices[6],
            vertices[7],
            vertices[5],
            vertices[7],
            vertices[6],
            vertices[4]
        };


        line       = new VectorLine("BoundingBoxLines", boxPoints, 5.0f);
        line.color = color;
        //line.joins = Joins.Weld;
        line.drawTransform = box.transform;
        line.Draw3DAuto();
        //line.active = false;
        boxMgr = GameObject.FindObjectOfType <BoundingBoxPoolManager>();
        //this is super slow
        //VectorManager.ObjectSetup (box, line, Visibility.Dynamic, Brightness.None);
    }
    private VectorLine RenderPoints()
    {
        VectorLine templine = null;

        // draws the line using Vectrosity library
        if (renderedPoints.Length > 1)
        {
            templine = new VectorLine("Line", renderedPoints, basicLineMaterial, 2.0f, LineType.Continuous);
            templine.Draw3DAuto();
        }

        return templine;
    }
    public IEnumerator Get(string url)
    {
        using (UnityWebRequest www = UnityWebRequest.Get(url))
        {
            yield return(www.SendWebRequest());

            if (www.isNetworkError)
            {
                Debug.Log(www.error);
            }
            else
            {
                if (www.isDone)
                {
                    result = @System.Text.Encoding.UTF8.GetString(www.downloadHandler.data);


                    globe = GameObject.Find("/earth/Icosphere");


                    var N = JSON.Parse(result);
                    // assign the length of all the to-from Array into an integer (118, on 03/09 evening)
                    length = Int32.Parse(N["length"].Value);
                    System.Random random = new System.Random();
                    x = random.Next(0, length);
                    y = random.Next(0, length);
                    z = random.Next(0, length);
                    // Debug.Log($"plane number {x}");

                    for (int i = 0; i < length; i++)
                    {
                        //bool hasCCto = countryCodes.Contains(N["data"]);
                        //bool hasCCfrom = countryCodes.Contains(N["data"][i]["from"]["country"]["cc"]);

                        //if (hasCCto && hasCCfrom) {
                        Airplane  instance = Instantiate(prefabs[0]);
                        Transform p        = instance.transform;
                        p.parent = globe.transform;
                        //p.localPosition = new Vector3(-2.999408f, -2.960107f - i, -.1357397f);
                        instance.ccTo               = N["data"][i]["to"]["country"]["cc"];
                        instance.ccFrom             = N["data"][i]["from"]["country"]["cc"];
                        instance.countryName        = N["data"][i]["to"]["country"]["name"];
                        instance.flag               = N["data"][i]["to"]["country"]["flag"];
                        instance.language           = N["data"][i]["to"]["country"]["languages"][0]["name"];
                        instance.greeting           = N["data"][i]["to"]["country"]["greeting"];
                        instance.animal             = N["data"][i]["to"]["country"]["animal"];
                        WatsonTextToSpeech.greeting = N["data"][i]["to"]["country"]["greeting"];
                        // instance.greeting = Encoding.UTF8.GetString(Encoding.Convert(Encoding.Unicode, Encoding.UTF8, Encoding.Unicode.GetBytes($"{greet}")));


                        departure = GameObject.FindGameObjectWithTag($"{instance.ccFrom}");
                        arrival   = GameObject.FindGameObjectWithTag($"{instance.ccTo}");
                        if (departure != null && arrival != null)
                        {
                            Vector3 midpoint = (departure.transform.position + arrival.transform.position) * 0.5f;
                            float   dist     = Vector3.Distance(departure.transform.position, arrival.transform.position);

                            p.position = Vector3.MoveTowards(midpoint, globe.transform.position, dist * -0.4f);
                            p.LookAt(Vector3.MoveTowards(arrival.transform.position, globe.transform.position, -2f));

                            //p.localRotation = Quaternion.Euler(208.305f, -2.268005f, -48.89499f);
                            //p.localScale = new Vector3(0.3f, 0.3f, 0.3f);

                            //change plane texture to flag texture of destination country
                            instance.GetComponent <MeshRenderer>().material.mainTexture = Resources.Load(instance.ccTo) as Texture2D;

                            var splinePoints = new List <Vector3>();
                            splinePoints.Add(departure.transform.localPosition);
                            splinePoints.Add(p.localPosition);
                            splinePoints.Add(arrival.transform.localPosition);
                            spline = new VectorLine("Spline", new List <Vector3>(segments + 1), 3.0f, LineType.Continuous); //LineType.Discrete
                            //spline.SetColor(new Color(204, 0, 82));
                            spline.MakeSpline(splinePoints.ToArray(), segments, loop);
                            //spline.MakeSpline(splinePoints.ToArray());
                            //spline.textureScale = 1.0f;
                            spline.drawTransform = globe.transform;
                            airplanes.Add(instance);
                            //Material lineMat = Resources.Load("ArcLine", typeof(Material)) as Material;
                            //spline.material = lineMat;
                            spline.Draw3DAuto();
                            //}
                        }
                    }
                    load.SetActive(false);
                    UI.SetActive(true);

                    hunt = GameObject.Find("/UIComponents/ScavengerHunt/huntImg");

                    // hunt.GetComponent<ScavengerHunt>().language = N["data"][x]["to"]["country"]["languages"][0]["name"];

                    hunt.GetComponent <ScavengerHunt>().countryname1 = N["data"][y]["to"]["country"]["name"];
                    hunt.GetComponent <ScavengerHunt>().animal       = N["data"][y]["to"]["country"]["animal"];
                    answerOne.countryCode = N["data"][y]["to"]["country"]["cc"];

                    hunt.GetComponent <ScavengerHunt>().countryname3 = N["data"][z]["to"]["country"]["name"];
                    hunt.GetComponent <ScavengerHunt>().flag         = N["data"][z]["to"]["country"]["cc"];
                    ScavengerHunt.CC        = N["data"][z]["to"]["country"]["cc"];
                    answerThree.countryCode = N["data"][z]["to"]["country"]["cc"];

                    while (N["data"][x]["to"]["country"]["languages"][0]["name"].Value == "English" || N["data"][x]["to"]["country"]["languages"][0]["name"].Value == "Spanish")
                    {
                        x = random.Next(0, length);
                    }

                    hunt.GetComponent <ScavengerHunt>().language     = N["data"][x]["to"]["country"]["languages"][0]["name"];
                    hunt.GetComponent <ScavengerHunt>().countryname2 = N["data"][x]["to"]["country"]["name"];
                    answerTwo.countryCode = N["data"][x]["to"]["country"]["cc"];
                }
                else
                {
                    Debug.Log("Error: Could not get data");
                }
            }
        }
    }
示例#33
0
    private void normalUpdate()
    {
        preview.SetActive(false);
        getClosestPoint();
        isColliding = false;
        //check if our preview is colliding with a placed sphere
        foreach (Transform transform in ((Networking)Networking.GetComponent(typeof(Networking))).allTransformList)
        {
            if (transform.CompareTag("Intermediate"))
            {
                if (transform.position == closestPoint && transform.GetComponent <IntermediateInfo>().GetConnections().Count >= 1)
                {
                    isColliding                = true;
                    currCollidingObj           = transform.gameObject;
                    preview.transform.position = transform.position;
                    preview.SetActive(true);
                    transform.GetComponent <IntermediateInfo>().HighlightPoint(true);
                }
                else
                {
                    transform.GetComponent <IntermediateInfo>().HighlightPoint(false);
                }
            }
        }

        if (OVRInput.GetDown(OVRInput.Button.One)) //Places the initial sphere
        {
            if (isColliding)
            {
                originSphere = currCollidingObj;
                originSet    = true;
                dottedLine   = new VectorLine("NewFreedomLine", new List <Vector3>(), dottedTexture, 8.0f);
                dottedLine.points3.Add(originSphere.transform.position);
                dottedLine.points3.Add(originSphere.transform.position);
                dottedLine.textureScale = 1.00f;
                dottedLine.Draw3DAuto();
                freedomLineObj = GameObject.Find("NewFreedomLine");

                failLine = new VectorLine("failLine", new List <Vector3>(), 8.0f);
                failLine.points3.Add(originSphere.transform.position);
                failLine.points3.Add(originSphere.transform.position);
                failLine.Draw3DAuto();
                failLine.SetColor(Color.red);
                failLineObj = GameObject.Find("failLine");
            }
        }

        if (OVRInput.Get(OVRInput.Button.One) && originSet)
        {
            origin = originSphere.transform.position;
            dest   = transform.position;
            originSphere.GetComponent <IntermediateInfo>().HighlightPoint(true);
            if (origin != Vector3.zero && dest != Vector3.zero)
            {
                dottedLine.points3[0] = dest;
                dottedLine.points3[1] = origin;

                failLine.points3[1] = origin;
                failLine.points3[0] = dest;
            }


            if (!InTruncation(originSphere, gameObject))
            {
                freedomLineObj.SetActive(false);
                failLineObj.SetActive(true);
            }
            else
            {
                freedomLineObj.SetActive(true);
                failLineObj.SetActive(false);
            }
        }


        if (OVRInput.GetUp(OVRInput.Button.One) && originSet)
        {
            originSet = false;
            if (originSphere.GetComponent <IntermediateInfo>().GetFreedomLine() != null || !InTruncation(originSphere, gameObject))
            {
                VectorLine.Destroy(ref dottedLine);
                VectorLine.Destroy(ref failLine);
                return;
            }

            GameObject finalLineObj = GameObject.Find("NewFreedomLine");
            finalLineObj.transform.parent = originSphere.transform;
            finalLineObj.name             = "FreedomLine";

            originSphere.GetComponent <IntermediateInfo>().SetFreedomLine(dottedLine, finalLineObj);
            originSphere.GetComponent <IntermediateInfo>().HighlightPoint(false);
            SwitchToConstraintMode(originSphere, gameObject);
        }
    }
示例#34
0
    // Update is called once per frame
    void Update()
    {
        getClosestPoint();
        preview.transform.position   = closestPoint;
        preview.transform.localScale = gameObject.transform.lossyScale;

        isColliding = false;
        preview.SetActive(true);
        //check if our preview is colliding with a placed sphere
        foreach (Transform transform in ((Networking)Networking.GetComponent(typeof(Networking))).allTransformList)
        {
            //print(dist);
            if (transform.position == closestPoint)
            {
                isColliding      = true;
                currCollidingObj = transform.gameObject;
                Color color = ((Renderer)transform.gameObject.GetComponent <Renderer>()).material.color;
                color.a = 1;
                ((Renderer)transform.gameObject.GetComponent <Renderer>()).material.color = color;
            }
            else
            {
                Color color = ((Renderer)transform.gameObject.GetComponent <Renderer>()).material.color;
                color.a = 0.353F;
                ((Renderer)transform.gameObject.GetComponent <Renderer>()).material.color = color;
            }
        }

        if (OVRInput.GetDown(OVRInput.Button.One)) //Places the initial sphere
        {
            forceCanvas.SetActive(true);
            if (isColliding && (currCollidingObj.CompareTag("Input") || currCollidingObj.CompareTag("Output")))
            {
                originSphere  = currCollidingObj;
                createdOrigin = false;
            }

            else if (!isColliding)
            {
                originSphere  = createPoint();
                createdOrigin = true;
            }
            else
            {
                return;
            }

            originSet       = true;
            currLine        = new VectorLine("NewForceLine", new List <Vector3>(), 30.0f);
            currLine.endCap = "Arrow";
            currLine.Draw3DAuto();
            currLine.points3.Add(originSphere.transform.position);
            currLine.points3.Add(originSphere.transform.position);
            currLine.SetColor(Color.blue);
        }

        if (OVRInput.Get(OVRInput.Button.One) && originSet)
        {
            origin = originSphere.transform.position;
            dest   = closestPoint;

            if (origin != Vector3.zero && dest != Vector3.zero)
            {
                currLine.points3[0] = dest;
                currLine.points3[1] = origin;
                Vector3 dest_local   = domain.transform.InverseTransformPoint(dest);
                Vector3 origin_local = domain.transform.InverseTransformPoint(origin);
                forceVectorLH = dest_local - origin_local;
                if (forceVectorLH.magnitude > 1)
                {
                    forceVectorLH.Normalize();
                }
                forceVectorRH  = new Vector3(forceVectorLH.x, forceVectorLH.y, -forceVectorLH.z);
                forceText.text = forceVectorRH.x.ToString("F4") + "\n" + forceVectorRH.y.ToString("F4") + "\n" + forceVectorRH.z.ToString("F4") + "\n" + forceVectorRH.magnitude.ToString("F4") + "\n";
            }
        }

        if (OVRInput.GetUp(OVRInput.Button.One) && originSet)
        {
            forceCanvas.SetActive(false);
            originSet = false;
            GameObject destSphere;
            GameObject InputOutputPoint;
            GameObject forcePoint;
            if (createdOrigin && (!isColliding || (isColliding && !(currCollidingObj.CompareTag("Input") || currCollidingObj.CompareTag("Output")))))
            {
                VectorLine.Destroy(ref currLine);
                ((Networking)Networking.GetComponent(typeof(Networking))).forceTransformList.Remove(originSphere.transform);
                Destroy(originSphere);
                createdOrigin = false;
                return;
            }
            else if (!createdOrigin && isColliding)
            {
                VectorLine.Destroy(ref currLine);
                createdOrigin = false;
                return;
            }
            else if (isColliding && createdOrigin)
            {
                destSphere       = currCollidingObj;
                InputOutputPoint = currCollidingObj;
                forcePoint       = originSphere;
            }
            else
            {
                destSphere       = createPoint();
                InputOutputPoint = originSphere;
                forcePoint       = destSphere;
            }

            if (InputOutputPoint.GetComponent <InputOutputInfo>().GetForcePoint() != null) //we already have a forcepoint
            {
                VectorLine.Destroy(ref currLine);
                Networking.GetComponent <Networking>().forceTransformList.Remove(forcePoint.transform);
                Destroy(forcePoint);
                createdOrigin = false;
                return;
            }

            GameObject vectorLineObj = GameObject.Find("NewForceLine");
            //vectorLineObj.transform.parent = forcePoint.transform;
            vectorLineObj.name = "ForceLine";
            //add to our force vector
            domain.GetComponent <InitLines>().forceVectorList.Add(forceVectorLH);

            //ForcePointInfo
            forcePoint.GetComponent <ForcePointInfo>().Setup(InputOutputPoint, currLine, createdOrigin);

            //InputOutputInfo
            Vector3    scale      = new Vector3(10, 10, 10);
            GameObject hemisphere = Hemisphere.CreateHemisphere(hemisphereMaterial, InputOutputPoint.transform.position, forcePoint.transform.position, !createdOrigin, scale);
            InputOutputPoint.GetComponent <InputOutputInfo>().Setup(InputOutputPoint, forcePoint, hemisphere, forceVectorRH, createdOrigin);
            hemisphere.transform.parent     = forcePoint.transform;
            hemisphere.transform.localScale = scale;
            createdOrigin = false;
        }
    }
示例#35
0
文件: GraphLines.cs 项目: rmc00/gsf
        public DataLine(GraphLines parent, Guid id, int index)
        {
            m_id = id;
            m_index = index;

            m_unscaledData = new float[parent.m_pointsInLine];

            m_vector = new VectorLine("DataLine" + index, new Vector3[parent.m_pointsInLine], parent.m_lineMaterial, parent.m_lineWidth, LineType.Continuous);
            m_vector.color = parent.m_lineColors[index % parent.m_lineColors.Length];
            m_vector.drawTransform = parent.m_target;
            m_vector.Draw3DAuto();

            for (int x = 0; x < m_vector.points3.Count; x++)
            {
                m_unscaledData[x] = float.NaN;
                m_vector.points3[x] = new Vector3(Mathf.Lerp(-5.0F, 5.0F, x / (float)m_vector.points3.Count), -((index + 1) * parent.m_lineDepthOffset + 0.05F), 0.0F);
            }
        }
示例#36
0
 public static VectorLine SetRay3D(Color color, float time, Vector3 origin, Vector3 direction)
 {
     var line = new VectorLine("SetRay3D", new Vector3[] {origin, new Ray(origin, direction).GetPoint(direction.magnitude)}, color, null, 1.0f, LineType.Continuous, Joins.None);
     line.Draw3DAuto (time);
     return line;
 }
示例#37
0
 public static VectorLine SetLine3D(Color color, float time, params Vector3[] points)
 {
     if (points.Length < 2) {
         LogError("VectorLine.SetLine3D needs at least two points");
         return null;
     }
     var line = new VectorLine("SetLine3D", points, color, null, 1.0f, LineType.Continuous, Joins.None);
     line.Draw3DAuto (time);
     return line;
 }
示例#38
0
    public static void ShowChessBoard()
    {
        float      dakuangTemp     = 0.5f;
        VectorLine dakuangPathLine = new VectorLine("DaKuang", new List <Vector3>(), 6.0f);

        dakuangPathLine.color        = Color.black;
        dakuangPathLine.textureScale = 1f;
        dakuangPathLine.points3.Add(new Vector3(0 - dakuangTemp, 1f, 0 - dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 8 + dakuangTemp, 1f, 0 - dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 8 + dakuangTemp, 1f, 0 - dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 8 + dakuangTemp, 1f, ChessEntity.ChessInterval * 9 + dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 8 + dakuangTemp, 1f, ChessEntity.ChessInterval * 9 + dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(0 - dakuangTemp, 1f, ChessEntity.ChessInterval * 9 + dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(0 - dakuangTemp, 1f, ChessEntity.ChessInterval * 9 + dakuangTemp));
        dakuangPathLine.points3.Add(new Vector3(0 - dakuangTemp, 1f, 0 - dakuangTemp));
        dakuangPathLine.Draw3DAuto();
        LayerManager.SetLayer(dakuangPathLine.rectTransform.gameObject, LayerManager.DefaultLayer);

        VectorLine xiaokuangPathLine = new VectorLine("XiaoKuang", new List <Vector3>(), 3.0f);

        xiaokuangPathLine.color        = Color.black;
        xiaokuangPathLine.textureScale = 1f;

        // 竖
        for (int idx = 0; idx <= 8; idx++)
        {
            if (idx == 0 || idx == 8)
            {
                xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * idx, 1f, 0));
                xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * idx, 1f, ChessEntity.ChessInterval * 9));
            }
            else
            {
                xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * idx, 1f, 0));
                xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * idx, 1f, ChessEntity.ChessInterval * 4));
                xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * idx, 1f, ChessEntity.ChessInterval * 5));
                xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * idx, 1f, ChessEntity.ChessInterval * 9));
            }
        }
        // 横
        for (int idx = 0; idx <= 9; idx++)
        {
            xiaokuangPathLine.points3.Add(new Vector3(0, 1f, ChessEntity.ChessInterval * idx));
            xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 8, 1f, ChessEntity.ChessInterval * idx));
        }
        // 士
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 3, 1f, ChessEntity.ChessInterval * 2));
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 5, 1f, 0));
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 3, 1f, 0));
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 5, 1f, ChessEntity.ChessInterval * 2));

        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 3, 1f, ChessEntity.ChessInterval * 9));
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 5, 1f, ChessEntity.ChessInterval * 7));
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 3, 1f, ChessEntity.ChessInterval * 7));
        xiaokuangPathLine.points3.Add(new Vector3(ChessEntity.ChessInterval * 5, 1f, ChessEntity.ChessInterval * 9));

        //
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 1, 1f, ChessEntity.ChessInterval * 2));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 7, 1f, ChessEntity.ChessInterval * 2));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 0, 1f, ChessEntity.ChessInterval * 3));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 2, 1f, ChessEntity.ChessInterval * 3));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 4, 1f, ChessEntity.ChessInterval * 3));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 6, 1f, ChessEntity.ChessInterval * 3));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 8, 1f, ChessEntity.ChessInterval * 3));

        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 1, 1f, ChessEntity.ChessInterval * 7));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 7, 1f, ChessEntity.ChessInterval * 7));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 0, 1f, ChessEntity.ChessInterval * 6));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 2, 1f, ChessEntity.ChessInterval * 6));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 4, 1f, ChessEntity.ChessInterval * 6));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 6, 1f, ChessEntity.ChessInterval * 6));
        DrawXiHuaPoint(xiaokuangPathLine, new Vector3(ChessEntity.ChessInterval * 8, 1f, ChessEntity.ChessInterval * 6));

        xiaokuangPathLine.Draw3DAuto();
        LayerManager.SetLayer(xiaokuangPathLine.rectTransform.gameObject, LayerManager.DefaultLayer);
    }