Пример #1
0
    IEnumerator DefaultLineIE()
    {
//		Debug.Log ("before Fixed");
        yield return(new WaitForEndOfFrame());

//		Debug.Log ("after Fixed");
        lr.Reset();
        lr.JitterMultiplier = 0f;

        foreach (LaserLine line in laserLines)
        {
            if (line.leftEnd && line.rightEnd)
            {
                // create a new line in renderer
                //				Debug.Log ("drawing line");
                FastLineRendererProperties props = new FastLineRendererProperties();
                props.Start = line.leftEnd.position;
                props.End   = line.rightEnd.position;

                props.Radius = lineRadius * radiusFactor;
                props.GlowIntensityMultiplier = glowIntensity;
                props.GlowWidthMultiplier     = glowWidthMultiplier;

                lr.AddLine(props, true, true);
            }
        }
        lr.Apply();
    }
Пример #2
0
 public void Redraw(GisViewer v)
 {
     lineRenderer.Reset();
     props.Radius = 1.5f * (float)v.GetResolution();
     foreach (var item in lst)
     {
         var geo = item.fea.GetGeometryRef().Clone();
         v.TransformGeometry2View(ref geo);
         DrawGeometry(geo);
         geo.Dispose();
     }
     lineRenderer.Apply();
 }
Пример #3
0
 void ClearData()
 {
     lineRenderer.Reset();
     if (trid != null)
     {
         //destroy all triangle objects
         foreach (Triangle t in trid.Values)
         {
             Destroy(t.drawingObject);
         }
     }
     //destroy all hint drawing objects
     hintDisplay.Reset();
     //reset our data
     puzzleEdges    = new PuzzleEdges();
     trid           = new Dictionary <Vector2Int, Triangle>();
     trisByCentroid = new Dictionary <Vector2, Triangle>();
     //
     //garbage collection should do the rest.
 }
Пример #4
0
    public void RenderPlanetOrbits()
    {
        for (int i = 0; i < orbitsMatrixPlanets.GetLength(0); i++)
        {
            FastLinePlanetline.Reset();
            GameObject go = new GameObject("Orbit");
            go.transform.SetParent(planetIDGameObjectMap[i].transform);
            go.transform.localPosition = new Vector3(0f, 0f, 0f);

            FastLineRenderer lr = FastLineRenderer.CreateWithParent(go, FastLinePlanetline);

            FastLineRendererProperties props = new FastLineRendererProperties();

            props.Radius     = orbitLineRadius;
            props.LineJoin   = FastLineRendererLineJoin.AttachToPrevious;
            lr.UseWorldSpace = true;
            // props.Color = new Color(0.67f, 0.66f, 0.50f, 0.25f);
            lr.AddLine(props, orbitsMatrixPlanets[i], null);
            lr.ScreenRadiusMultiplier = orbitLineScale;

            lr.Apply();
        }

        //for (int i = 0; i < orbitsMatrixPlanets.GetLength(0); i++)
        //{
        //    GameObject go = new GameObject("Orbit");
        //    go.transform.SetParent(planetIDGameObjectMap[i].transform);
        //    go.transform.localPosition = new Vector3(0f, 0f, 0f);


        //    LineRenderer lr = Instantiate<LineRenderer>(LineOrbits, go.transform);
        //    lr.enabled = true;

        //    lr.name = "Orbit-" + solarsystem.Planets[i].OrbitalID;
        //    orbitsPlanets.Add(lr);
        //    lr.startWidth = 1f;
        //    lr.endWidth = 1f;
        //    lr.positionCount = segments;
        //    lr.SetPositions(orbitsMatrixPlanets[i]);
        //}
    }
Пример #5
0
    public void RenderMoonOrbits()
    {
        //for (int i = 0; i < orbitsMatrixMoons.GetLength(0); i++)
        //{
        //     LineRenderer lr = Instantiate<LineRenderer>(
        //         LineOrbits, planetIDGameObjectMap[solarsystem.Moons[i].Parent.OrbitalID].transform);
        //    lr.enabled = enable;
        //    lr.useWorldSpace = false;
        //    lr.name = "Orbit-" + solarsystem.Moons[i].Parent.OrbitalID.ToString() +
        //        "-" + solarsystem.Moons[i].OrbitalID.ToString();
        //    orbitsMoons.Add(lr);
        //    lr.startWidth = 60f;
        //    lr.endWidth = 60f;
        //    lr.startColor = moonsOrbitColour;
        //    lr.endColor = moonsOrbitColour;
        //    lr.positionCount = segmentsMoons;
        //    lr.SetPositions(orbitsMatrixMoons[i]);
        //}

        for (int i = 0; i < orbitsMatrixMoons.GetLength(0); i++)
        {
            FastLineMoonline.Reset();
            GameObject go = new GameObject("Orbit-Moon");
            go.transform.SetParent(planetIDGameObjectMap[solarsystem.Moons[i].Parent.OrbitalID].transform);
            go.transform.localPosition = new Vector3(0f, 0f, 0f);

            FastLineRenderer lr = FastLineRenderer.CreateWithParent(go, FastLineMoonline);

            FastLineRendererProperties props = new FastLineRendererProperties();

            props.Radius     = orbitLineRadius;
            props.LineJoin   = FastLineRendererLineJoin.AttachToPrevious;
            lr.UseWorldSpace = false;
            // props.Color = new Color(0.51f, 0.67f, 0.50f, 0.25f);
            lr.AddLine(props, orbitsMatrixMoons[i], null);
            lr.ScreenRadiusMultiplier = orbitLineScale;

            lr.Apply();
        }
    }
        private void CreateContinuousLineFromList()
        {
            // reset the line renderer - if you are appending to an existing line, don't call reset, as you would lost all the previous points
            LineRenderer.Reset();

            // generate zig zag
            List <Vector3> points = new List <Vector3>();

            for (int i = 0; i < 50; i++)
            {
                points.Add(new Vector3(-200 + (i * 10.0f), 100 + (150.0f * -(i % 2)), 0.0f));
            }

            // animation time per segment - set to 0 to have the whole thing appear at once
            const float animationTime = 0.1f;

            // create properties - do this once, before your loop
            FastLineRendererProperties props = new FastLineRendererProperties();

            props.Radius   = 0.1f;
            props.LineJoin = FastLineRendererLineJoin.Round;

            // add the list of line points
            LineRenderer.AddLine(props, points, (FastLineRendererProperties _props) =>
            {
                // random color
                props.Color = new Color32((byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)Random.Range(0, 256), byte.MaxValue);

                // animate this line segment in later
                props.AddCreationTimeSeconds(animationTime);

                // increase the radius
                props.Radius += 0.05f;
            }, true, true);

            // must call apply to make changes permanent
            LineRenderer.Apply();
        }
Пример #7
0
 public void Clear()
 {
     lineRenderer.Reset();
 }