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


C# LineRenderer.SetVertexCount方法代码示例

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


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

示例1: Cast

 public void Cast(string gestureClass, PDollarGestureRecognizer.Gesture gesture, LineRenderer line)
 {
     Debug.Log ("Cast " + gestureClass + "!");
     switch (gestureClass)
     {
     case("Circle"):
         float maxX = float.MinValue;
         float minX = float.MaxValue;
         float maxY = float.MinValue;
         float minY = float.MaxValue;
         foreach(PDollarGestureRecognizer.Point point in gesture.Points){
             if(point.X > maxX){
                 maxX = point.X;
             }
             if(point.X < minX){
                 minX = point.X;
             }
             if(point.Y > maxY){
                 maxY = point.Y;
             }
             if(point.Y < minY){
                 minY = point.Y;
             }
         }
         Vector3 center = new Vector3((maxX + minX)/2, 1, (maxY + minY)/2);
         line.SetVertexCount (33);
         line.SetPosition (32, center);
         Debug.Log (center);
         break;
     case("line"):
         break;
     case("X"):
         break;
     }
 }
开发者ID:CwnRheswm,项目名称:DelveTowerDefense,代码行数:35,代码来源:SpellBook.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        path = NewPath();
        iTween.PutOnPath(pfadPrefab, path, 1);
        pfadPrefab.SetActive (true);
        hash.Clear();
        hash.Add ("name", "moveOnRandom");
        hash.Add ("path", path);
        hash.Add ("time", time);
        hash.Add ("oncomplete", "Die");
        hash.Add ("easetype", iTween.EaseType.linear);

        pfadPrefab.SetActive (true);
        Move ();
        path.Initialize ();

        mittelpunkt = GameObject.FindGameObjectWithTag("mittelpunkt");

        lineSegmentCount = 1;

        line = gameObject.AddComponent("LineRenderer") as LineRenderer;
        line.SetWidth (0.1f, 0.1f);
        line.material = material;
        line.SetColors (Color.white, Color.white);
        line.SetVertexCount (lineSegmentCount);
        line.renderer.enabled = true;
        line.SetPosition(lineSegmentCount-1, mittelpunkt.transform.position);
    }
开发者ID:TillusB,项目名称:GyroscopeGame,代码行数:29,代码来源:PfadBehaviour.cs

示例3: Start

 // Use this for initialization
 void Start()
 {
     ln = GetComponent<LineRenderer> ();
     aud = GetComponent<AudioSource> ();
     wave = new float[samples];
     ln.SetVertexCount (wave.Length);
 }
开发者ID:dlobser,项目名称:beach,代码行数:8,代码来源:audioToLine.cs

示例4: reset

    public void reset()
    {
        startPos.x = 0;
        startPos.y = 0;
        startPos.z = 0;

        endPos.x = 0;
        endPos.y = 0;
        endPos.z = 0;

        penDown = false;
        sessionStart = false;
        inSession = false;

        localLRend = this.transform.gameObject.GetComponent<LineRenderer>();
        localLRend.material = new Material(Shader.Find("Diffuse"));
        localLRend.material.color = Color.black;
        localLRend.castShadows = false;
        localLRend.receiveShadows = false;
        localLRend.SetVertexCount(2);
        localLRend.SetWidth(lineThickness,lineThickness);
        localLRend.SetColors(Color.black,Color.black);

        localLRend.SetPosition(0,Vector3.zero);
        localLRend.SetPosition(1,Vector3.zero);
        localLRend.enabled = false;
    }
开发者ID:TAPeri,项目名称:WordsMatter,代码行数:27,代码来源:LineDragNDraw.cs

示例5: Start

		void Start()
		{
			startTime = Time.time;
			prevPosition = gameObject.transform.position;
			
			sourceOriginalV = sourceVessel.rigidbody.velocity;
			
			Light light = gameObject.AddComponent<Light>();
			light.type = LightType.Point;
			light.color = lightColor;
			light.range = 8;
			light.intensity = 1;
			
			bulletTrail = gameObject.AddComponent<LineRenderer>();
			bulletTrail.SetVertexCount(2);
			bulletTrail.SetPosition(0, transform.position);
			bulletTrail.SetPosition(1, transform.position);
			bulletTrail.SetWidth(tracerStartWidth, tracerEndWidth);
			bulletTrail.material = new Material(Shader.Find("KSP/Particles/Alpha Blended"));
			bulletTrail.material.mainTexture = GameDatabase.Instance.GetTexture("BDArmory/Textures/bullet", false);
			bulletTrail.material.SetColor("_TintColor", projectileColor);
			
			rigidbody.useGravity = false;
			
		}
开发者ID:kevincoggins,项目名称:BDArmory,代码行数:25,代码来源:BahaTurretBullet.cs

示例6: CreateLineMaker

	public void CreateLineMaker(bool criticalLine) {		
		GameObject newLineMaker = (GameObject)Instantiate(lineMakerPrefab, Vector3.zero, Quaternion.identity);
		newLineMaker.transform.parent = transform;
		lineRenderer = newLineMaker.GetComponent<LineRenderer>();
		lineRenderer.SetVertexCount(0);
		vertices = new List<Vector3>();
	}
开发者ID:angl3m3th,项目名称:Conversation_Drawer,代码行数:7,代码来源:Tracer.cs

示例7: Start

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

        lineRenderer.SetVertexCount(trailResolution);

        lineSegmentPositions = new Vector3[trailResolution];
        lineSegmentVelocities = new Vector3[trailResolution];

        facingDirection = GetDirection();

        // Initialize our positions
        for (int i = 0; i < lineSegmentPositions.Length; i++)
        {
            lineSegmentPositions[i] = new Vector3();
            lineSegmentVelocities[i] = new Vector3();

            if (i == 0)
            {
                // Set the first position to be at the base of the transform
                lineSegmentPositions[i] = transform.position;
            }
            else
            {
                // All subsequent positions would be an offset of the original position.
                lineSegmentPositions[i] = transform.position + (facingDirection * (offset * i));
            }
        }
    }
开发者ID:JohnathanWells,项目名称:gameDesignClass.github.io,代码行数:30,代码来源:manualTrail.cs

示例8: connect

 public void connect(FuzzyGUIElement a, FuzzyGUIElement b)
 {
     line = gameObject.AddComponent<LineRenderer>();
     line.SetVertexCount(2);
     this.a = a;
     this.b = b;
 }
开发者ID:CatmanIta,项目名称:FuzzyTactics,代码行数:7,代码来源:FuzzyGUIConnection.cs

示例9: Start

    void Start()
    {
        // Link to LeanTouch events
        LeanTouch.OnFingerDown += OnFingerDown;
        LeanTouch.OnFingerUp += OnFingerUp;
        LeanTouch.OnSoloDrag += OnSoloDrag;
        LeanTouch.OnMultiDrag += OnMultiDrag;
        currFinger = null;

        // Initialize LineRenderer
        lineGameObject = new GameObject("SlashLine");
        lineGameObject.AddComponent<LineRenderer>();

        lineRenderer = lineGameObject.GetComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
        lineRenderer.SetColors(c0, c1);
        lineRenderer.SetWidth(0.1f, 0f);
        lineRenderer.SetVertexCount(0);

        // Initialize other variables
        i = 0;
        slashing = false;
        soloDragging = false;
        currSoloDragDelta = Vector2.zero;

        // Init GM ref
        GM = GameObject.Find("GameManager").GetComponent<GameManager>();
    }
开发者ID:wchaney98,项目名称:Hero-Forever,代码行数:28,代码来源:PlayerSlice.cs

示例10: 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

示例11: Start

	void Start () {
	    lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.SetColors(Color.red, Color.red);
        lineRenderer.material = mat;
        lineRenderer.SetWidth(0.1f, 0.1f);
        lineRenderer.SetVertexCount(2);
	}
开发者ID:noa99kee,项目名称:KinectUnity,代码行数:7,代码来源:LineToObject.cs

示例12: Start

    // Use this for initialization
    void Start()
    {
        Transform images = this.transform.FindChild("images");
        if (lastHatIdx == -1)
        {

            lastHatIdx = Random.Range(0, images.childCount);
        }

        grabRadius = 15f;// this.GetComponent<SphereCollider>().radius * 2;
        line = this.transform.FindChild("line").GetComponent<LineRenderer>();
        line.SetVertexCount(nLineVertices);
        line.enabled = false;

        //prevent subsequent duplicates
        int newHatIdx = Random.Range(0, images.childCount);
        if (newHatIdx == lastHatIdx)
        {
            newHatIdx = (newHatIdx + 1) % images.childCount;
        }
        lastHatIdx = newHatIdx;

        images.GetChild(newHatIdx).gameObject.SetActive(true);

        grabSound = Resources.Load("can") as AudioClip;
        releaseSound = Resources.Load("click") as AudioClip;
    }
开发者ID:OpaqueMegane,项目名称:savvy-chopper,代码行数:28,代码来源:Grabbable.cs

示例13: Start

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

        if (!customColor)
        {
            if (hit) col = new Color(0,1,1,0.35f);
            if (!hit) col = new Color(1,0.5f,0,0.35f);
        }

        lr.SetColors(col,col);

        float distance = Vector3.Distance(start,end);
        Vector3 direction = (end-start).normalized;

        int stepCount = Mathf.FloorToInt(distance / 0.5f);

        points = new Vector3[stepCount];
        moves = new Vector3[stepCount];
        for (int i=0; i<stepCount; i++){
            points[i] = start + (direction * i * 0.5f);
            points[i] += new Vector3(Random.Range(-Spread,Spread),Random.Range(-Spread,Spread),Random.Range(-Spread,Spread));
            moves[i] = new Vector3(Random.Range(-Spread,Spread),Random.Range(-Spread,Spread),Random.Range(-Spread,Spread));
        }

        lr.SetVertexCount(points.Length+1);
        for (int i=0; i<stepCount; i++){
            lr.SetPosition(i,points[i]);
        }
        lr.SetPosition(points.Length,end);
        //lr.SetPosition(0,start);
        //lr.SetPosition(1,end);
    }
开发者ID:madpew,项目名称:SplatDeathSalad,代码行数:34,代码来源:SwapperBullet.cs

示例14: Start

	void Start () {
        
        lineRenderer = GetComponent<LineRenderer>();
        lineRenderer.SetVertexCount(0);
        lineRenderer.SetColors(Color.white, Color.white);
        float sevenTwo = 72 * Mathf.Deg2Rad;
        points = new List<GameObject>();
        clearedPoints = new List<Vector3>();
        for (int i = 0; i < 5; i++)
        {
            float ang = Mathf.PI * 3 / 2 + sevenTwo * i;
            Vector3 pos = new Vector3(Mathf.Cos(ang), Mathf.Sin(ang), 0) * radius;
            GameObject newPoint = GameObject.Instantiate(pentPoint);
            newPoint.transform.position = pos;
            newPoint.GetComponent<PentagramPointController>().controller = this;
            points.Add(newPoint);
        }

        for (int i = 0; i < 5; i++)
        {
            points[i].GetComponent<PentagramPointController>().pair = points[(i + 3) % 5].GetComponent<PentagramPointController>();
        }

        points[0].GetComponent<PentagramPointController>().select(true);
    }
开发者ID:spectrix,项目名称:Exorsister,代码行数:25,代码来源:PentagramGameController.cs

示例15: Update

 // Update is called once per frame
 void Update()
 {
     line = transform.GetComponent<LineRenderer> ();
         line.SetVertexCount (2);
         line.SetPosition (0, gameObject.transform.position);
         line.SetPosition (1, length.transform.position);
 }
开发者ID:Haserde,项目名称:Week-5,代码行数:8,代码来源:fishingLine.cs


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