当前位置: 首页>>代码示例>>C#>>正文


C# LineRenderer.SetPositions方法代码示例

本文整理汇总了C#中UnityEngine.LineRenderer.SetPositions方法的典型用法代码示例。如果您正苦于以下问题:C# LineRenderer.SetPositions方法的具体用法?C# LineRenderer.SetPositions怎么用?C# LineRenderer.SetPositions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.LineRenderer的用法示例。


在下文中一共展示了LineRenderer.SetPositions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    // Use this for initialization
    void Start()
    {
        GameObject lockedCrosshairImage = new GameObject();
        Image crossHairImage = lockedCrosshairImage.AddComponent<Image>();

        crossHairImage.rectTransform.pivot = new Vector2(0.5f,0.5f);
        crossHairImage.rectTransform.anchorMax = Vector2.zero;
        crossHairImage.rectTransform.anchorMin = Vector2.zero;
        crossHairImage.rectTransform.sizeDelta = new Vector2(64,64);

        crossHairImage.raycastTarget = false;
        crossHairImage.sprite = trackingCrosshair;
        crossHairImage.color = Color.black;
        crossHairImage.type = Image.Type.Filled;
        crossHairImage.fillMethod = Image.FillMethod.Radial360;
        crossHairImage.fillAmount = 0;

        //TODO get reference to the correct canvas
        Canvas canvas = GameObject.Find("Canvas").GetComponent<Canvas>();

        crossHairImage.transform.SetParent(canvas.transform);
        crossHairImage.transform.SetAsFirstSibling();
        crossHairImage.transform.localScale = Vector3.one;

        myTrackingCrosshair = crossHairImage;

        myTargetingLine = myTrackingModule.gameObject.AddComponent<LineRenderer>();

        myTargetingLine.useWorldSpace = true;
        myTargetingLine.SetVertexCount(2);
        myTargetingLine.SetPositions(new Vector3[]{Vector3.zero,Vector3.zero});
        myTargetingLine.SetWidth(0.5f,0.5f);
        myTargetingLine.SetColors(Color.red,Color.red);
        myTargetingLine.enabled = false;
    }
开发者ID:xarephonic,项目名称:mercenarywings,代码行数:36,代码来源:TrackerUI.cs

示例2: RenderGesture

        public void RenderGesture(Gesture nextGesture)
        {
            if (currentGestureLineRenderer != null) Destroy(currentGestureLineRenderer.gameObject);

            currentGestureLineRenderer = Instantiate(gestureOnScreenPrefab).GetComponent<LineRenderer>();

            Vector3[] rendererPoints = nextGesture.Points
                .Select(gesturePoint => new Vector3(gesturePoint.X, -gesturePoint.Y, 0))
                .ToArray();

            currentGestureLineRenderer.SetVertexCount(rendererPoints.Length);
            currentGestureLineRenderer.SetPositions(rendererPoints);

            StartCoroutine("TransformGesture");
        }
开发者ID:Pavelko007,项目名称:Shape-Replica,代码行数:15,代码来源:GestureRenderer.cs

示例3: MakeLine

    void MakeLine()
    {
        GameObject go = new GameObject();
        lineRenderer = go.AddComponent<LineRenderer>();
        lineRenderer.SetVertexCount(3);
        Vector3[] positions = new Vector3[3];
        positions[0] = Vector3.one + offset;
        positions[1] = positions[0] + Vector3.one;
        positions[2] = positions[1] + Vector3.one;
        lineRenderer.SetPositions(positions);

        lineRenderer.useWorldSpace = false;
        offset += Vector3.one;

        go.transform.SetParent(gameObject.transform);
    }
开发者ID:Naphier,项目名称:Unity-Tutoring-Steve-K,代码行数:16,代码来源:MyMonobehaviour1.cs

示例4: Start

        // Use this for initialization
        void Start()
        {
            lr = GetComponent<LineRenderer>();

            //lr.SetPosition(0, go1.transform.position);
            //lr.SetPosition(1, go2.transform.position);

            var positions = new Vector3[3] {
            go1.transform.position,
            go2.transform.position,
            go3.transform.position
        };

            lr.SetPositions(positions);

        }
开发者ID:davidMa88,项目名称:shotemup_repo,代码行数:17,代码来源:WaypointsController.cs

示例5: Start

 public void Start()
 {
     line = GetComponent<LineRenderer>();
     line.SetPositions(new Vector3[transform.childCount + 1]);
 }
开发者ID:Nicolas-Constanty,项目名称:TeamTrash,代码行数:5,代码来源:Rope.cs

示例6: Start

    // Use this for initialization
    void Start()
    {
        MiMi = GameObject.FindWithTag("MiMi");
        lr = gameObject.AddComponent<LineRenderer>();

        lr.material = new Material(shader2);
        lr.material.color = new Color(0f, 1f, 0f, 0.05f);
        lr.SetWidth(0.5f, 0.5f);
        Vector3[] points = { gameObject.transform.position + new Vector3(0.0f, 0.0f, 0.0f), WireAnchor.transform.position + new Vector3(0.0f, 0.0f, 0.0f) };
        lr.SetPositions(points);

        canAttach = false;
        attached = false;
    }
开发者ID:PatrikkSorensen,项目名称:GAMEDEV2016,代码行数:15,代码来源:PlugPullScript.cs

示例7: SetUpTargetingReticle

    /// <summary>
    /// Creates the vertices for the targeting laser
    /// </summary>
    private void SetUpTargetingReticle()
    {
        reticle = gameObject.GetComponentInChildren<LineRenderer>();

        //reticle.SetVertexCount(100);

        Vector3[] positions = new Vector3[100];

        for (int i = 0; i < positions.Length; i++)
        {
            positions[i].x = 0;
            float t = i * .25f;
            t = t * t;
            positions[i].y = -.5f * 9.81f * t;
            positions[i].z = i * 50 * .25f;
        }
        reticle.SetPositions(positions);
    }
开发者ID:joshkillinger,项目名称:TankDuel,代码行数:21,代码来源:PlayerScript.cs

示例8: SetupLineRenderer

 // Initialisiert die LineRenderer Komponente
 void SetupLineRenderer()
 {
     lineRenderer = this.GetComponent<LineRenderer>();
     lineRendererVertices = new Vector3[lineRendererVertexCount];
     lineRenderer.material = lineMaterial;
     lineRenderer.SetVertexCount(lineRendererVertexCount);
     AlignVerticesInCircle(transform.position, ref lineRendererVertices);
     lineRenderer.SetPositions(lineRendererVertices);
 }
开发者ID:sixeco,项目名称:Unnoticed,代码行数:10,代码来源:SVI_I.cs


注:本文中的UnityEngine.LineRenderer.SetPositions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。