• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.LineRenderer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



LineRenderer类属于UnityEngine命名空间,在下文中一共展示了LineRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Awake

 void Awake()
 {
     m_linerenderer = GetComponent<LineRenderer>();
     m_points = new List<Vector3>();
     m_camera = Camera.main;
     m_toCommence = true;
 }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:7,代码来源:LineListener.cs


示例2: Update

    // Update is called once per frame
    void Update()
    {
        lineRenderer = GetComponent<LineRenderer>();

        //Vector3 pos = new Vector3(mob.Health/maxHealth,0,0);
        //lineRenderer.SetPosition(0, pos);
    }
开发者ID:GuBaDa,项目名称:SuperGreatGame,代码行数:8,代码来源:HPBarMob.cs


示例3: Start

 // Use this for initialization
 void Start()
 {
     lineRend = GetComponent<LineRenderer>();
     endPositionExtended = endPos.localPosition;
     var audios = GetComponents<AudioSource>();
     audio = audios [0];
 }
开发者ID:CaptainStouf,项目名称:TheKinectAwakens,代码行数:8,代码来源:lightsabers.cs


示例4: Awake

	// Use this for initialization
	void Awake () {
        ignoreCollisionList = new List<Collider2D>();

        rigid = GetComponent<Rigidbody2D>();

        ball = this.gameObject.AddComponent<PolygonCollider2D>();
        ball.sharedMaterial = ballPhysicsMat;

        rend = GetComponent<LineRenderer>();

        Vector2[] points = new Vector2[2 * (numSides + 1)];
        rend.SetVertexCount(numSides + 1);

        float visualRadius = (outerRadius + innerRadius) / 2;
        rend.SetWidth(outerRadius - innerRadius, outerRadius - innerRadius);

        // inner points
        for (int i = 0; i <= numSides; i++)
        {
            float angle = TwoPI * i / numSides;
            Vector2 direction = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle));
            points[i] = innerRadius * direction;
            rend.SetPosition(i, visualRadius * direction);

        }

        // outer points
        for (int i = numSides + 1; i < points.Length; i++)
        {
            float angle = TwoPI * i / numSides;
            points[i] = new Vector2(outerRadius * Mathf.Cos(angle), outerRadius * Mathf.Sin(angle));
        }

        ball.points = points;
	}
开发者ID:AlbearKamoo,项目名称:Witches-vs-Aliens-2015-2016,代码行数:36,代码来源:HampsterBall.cs


示例5: Start

    void Start()
    {
        if ( !tr ) tr = transform;
        lRenderer = tr.GetComponent<LineRenderer>();

        ChoseNewAnimationTargetCoroutine();
    }
开发者ID:neozman,项目名称:JunctionBox,代码行数:7,代码来源:LaserScope.cs


示例6: Start

	void Start ()
	{
		isActive = false;

		spaceCraftHelper = new GameObject[numOfHelpers];
		planetHelper = new GameObject[numOfHelpers];

		for (int i = 0; i < numOfHelpers; i++) {
			spaceCraftHelper [i] = Instantiate (Resources.Load ("Prefabs/Helper") as GameObject) as GameObject;
			spaceCraftHelper [i].transform.localScale = new Vector3 (helperSize, helperSize, helperSize);
			spaceCraftHelper [i].SetActive (isActive);
		}
		for (int i = 0; i < numOfHelpers; i++) {
			planetHelper [i] = Instantiate (Resources.Load ("Prefabs/Helper") as GameObject) as GameObject;
			planetHelper [i].transform.localScale = new Vector3 (helperSize, helperSize, helperSize);
			planetHelper [i].SetActive (isActive);
		}

		earth = GameObject.Find ("Earth");
		poEarth = earth.GetComponent<PlanetaryOrbit> ();

		lineRendererLength = 40;
		line = gameObject.GetComponent<LineRenderer> () as LineRenderer;
		line.material = Resources.Load ("Materials/LineAux") as Material;
		line.SetWidth (5f, 5f);
		line.SetVertexCount (lineRendererLength);
	}
开发者ID:hybrid1969,项目名称:SolarSystemSimulatorGame,代码行数:27,代码来源:AuxOrbit.cs


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


示例8: Awake

    void Awake()
    {
        //lane = 1;
        particles = transform.GetChild (0).gameObject.GetComponent<ParticleSystem> ();
        beam = transform.GetChild (1).gameObject.GetComponent<ParticleSystem> ();
        line = transform.GetChild (2).gameObject.GetComponent<LineRenderer> ();
        inLaserSequence = false;
        inSplitSequence = false;
        isActive = true;
        startFadeOut = false;
        startFadeIn = false;

        line.sortingLayerName = "Explosion/Fizz";
        transform.position += Vector3.up * -(lane - 2);
        if (Team == "Blue") {
            particles.transform.position = GameObject.FindGameObjectWithTag ("BlueBase").transform.position + Vector3.up * -(lane - 2);
        } else if (Team == "Red") {
            particles.transform.position = GameObject.FindGameObjectWithTag ("RedBase").transform.position + Vector3.up * -(lane - 2);
        }

        particles.Play ();
        Invoke ("beginBeam", 0.5f);
        Invoke ("drawLine", 1);
        Invoke ("setLooping", 2);
        Invoke ("setInactive", 1.5f);
        Invoke ("destroy", 3);
        Debug.Log (particles.gameObject.transform.position);
    }
开发者ID:Avekeez,项目名称:Space-Wars-Unity,代码行数:28,代码来源:LaserLogic.cs


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


示例10: Start

		void Start()
		{
			startTime = Time.time;
			prevPosition = gameObject.transform.position;
			
			Light light = gameObject.AddComponent<Light>();
			light.type = LightType.Point;
			light.range = 15;
			light.intensity = 8;
			
			audioSource = gameObject.AddComponent<AudioSource>();
			audioSource.minDistance = 0.1f;
			audioSource.maxDistance = 75;
			audioSource.clip = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/shellWhistle");
			audioSource.volume = Mathf.Sqrt(GameSettings.SHIP_VOLUME);// * 0.85f;
			audioSource.dopplerLevel = 0.02f;
			
			explosion = GameDatabase.Instance.GetModel("BDArmory/Models/explosion/explosion");
			explosion.SetActive(true);
			
			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/Additive"));
			bulletTrail.material.mainTexture = GameDatabase.Instance.GetTexture("BDArmory/Textures/bullet", false);
			bulletTrail.material.SetColor("_TintColor", projectileColor);
			
			
			rigidbody.useGravity = false;
			
		}
开发者ID:kevincoggins,项目名称:BDArmory,代码行数:33,代码来源:CannonShell.cs


示例11: Start

 // Use this for initialization
 void Start()
 {
     line = GetComponent<LineRenderer>();
     SpriteRenderer spriteRenderer = GetComponent<SpriteRenderer>();
     line.sortingLayerID = spriteRenderer.sortingLayerID;
     line.sortingOrder = spriteRenderer.sortingOrder;
 }
开发者ID:denjin,项目名称:Castles,代码行数:8,代码来源:LineManager.cs


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


示例13: Awake

 void Awake()
 {
     playerController = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerController> ();
     ShotSpawnPos = GameObject.FindGameObjectWithTag("ShotSpawn");
     ShootableMask = LayerMask.GetMask ("Shootable"); // get a reference to the shootable mask
     ShotLine = ShotSpawnPos.GetComponent<LineRenderer> ();   // get reference to the line AKA bullet
 }
开发者ID:mrkennyschafer,项目名称:Meditational_Gaming,代码行数:7,代码来源:FireWeapons.cs


示例14: Start

 void Start()
 {
     line = GetComponent<LineRenderer>();
     line.SetVertexCount(2);
     line.GetComponent<LineRenderer>().material = lineMaterial;
     line.SetWidth(0.1f, 0.1f);
 }
开发者ID:KeijiKimura,项目名称:Calypso,代码行数:7,代码来源:RayGun.cs


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


示例16: Start

    void Start () {
		input = GameObject.FindWithTag ("InputControl").GetComponent<InputControl> ();
		god = GameObject.FindWithTag ("GameController").GetComponent<God> ();
        intensityText = GameObject.Find("Intensity");
        line = gameObject.GetComponent<LineRenderer> ();
		line.enabled = false;
	}
开发者ID:NoaAka,项目名称:P6,代码行数:7,代码来源:LaserCharge.cs


示例17: Start

    // Use this for initialization
    void Start()
    {
        lineRenderer = GetComponent<LineRenderer>(); // grab reference to LineRenderer, since it's not assigned in inspector

        // call RecordPosition() every 2 seconds after an initial delay of 0 seconds
        InvokeRepeating("RecordPosition", 0f, recordFrequency);
    }
开发者ID:sophiekaars,项目名称:Building-Worlds,代码行数:8,代码来源:LineLogger.cs


示例18: Start

 // Use this for initialization
 void Start()
 {
     pointer = GameObject.Find("PointerRoot").transform;
     pointer_stick = GameObject.Find("Pointer_stick").gameObject;
     line = pointer_stick.GetComponent<LineRenderer>();
     pbox = GameObject.Find("Pointer").transform;
 }
开发者ID:DomCristaldi,项目名称:CaveVR,代码行数:8,代码来源:PointerControl.cs


示例19: Start

 // Use this for initialization
 void Start()
 {
     lineRenderer = GetComponent<LineRenderer>();
     lineRenderer.SetPosition(0, origin.position);
     lineRenderer.SetPosition(1, origin.position + (destination.position - origin.position) * 0);
     distance = Vector3.Distance(origin.position, destination.position);
 }
开发者ID:telhurin,项目名称:Test,代码行数:8,代码来源:LineController.cs


示例20: Start

    //Variables End___________________________________________________________
    // Use this for initialization
    void Start()
    {
        if(networkView.isMine == true)
        {
            //Store a reference to these objects since we will need to reference
            //them frequently.

            myTransform = transform.parent;

            cameraHeadTransform = myTransform.FindChild("CameraHead");

            resourceScript = myTransform.GetComponent<PlayerResource>();

            changeScript = myTransform.GetComponent<ChangeWeapon>();

            //Attaching a LineRenderer component which will give a visual
            //effect for the block eraser. Only the player will be able to see it.

            lineRenderer = gameObject.AddComponent<LineRenderer>();

            lineRenderer.material = new Material(Shader.Find("Particles/Additive"));

            lineRenderer.SetColors(c1, c2);

            lineRenderer.SetWidth(0.04f, 0.01f);

            lineRenderer.SetVertexCount(2); //Start and end position.
        }

        else
        {
            enabled = false;
        }
    }
开发者ID:AnthonyB28,项目名称:FPS_Unity,代码行数:36,代码来源:FireBlockEraser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.Material类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.Light类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap