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


C# LineRenderer.GetComponent方法代码示例

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


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

示例1: Start

	void Start () 
	{
		laserOn = true;
		laser = gameObject.GetComponent<LineRenderer>();
		laser.enabled = true;
		laserTex = laser.GetComponent<Renderer>();
		laserTex.enabled = true;
		laserLight = laser.GetComponent<Light>();
		laserLight.enabled = true;
		lap = GetComponentInParent<lookAtPlayer>();
	}
开发者ID:coderDarren,项目名称:GGJ2016,代码行数:11,代码来源:laserScript.cs

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

示例3: EraseAlpha

    IEnumerator EraseAlpha(LineRenderer target, float time)
    {
        Renderer renderer = target.GetComponent<Renderer>();

        float originalStartAlpha = 1f;
        float destinationStartAlpha = 0f;

        float originalEndAlpha = 1f;
        float destinationEndAlpha = 0f;

        float currentTime = 0.0f;

        Color startColor = Color.black;
        Color endColor = Color.black;

        do
        {
            startColor.a = Mathf.Lerp(originalStartAlpha, destinationStartAlpha, currentTime / time);
            endColor.a = Mathf.Lerp(originalEndAlpha, destinationEndAlpha, currentTime / time);

            target.SetColors(startColor, endColor);
            currentTime += Time.deltaTime;
            yield return null;
        }
        while (currentTime <= time);

        // destroy self after fading away
        Destroy(gameObject);
    }
开发者ID:CobaltBlack,项目名称:Project-Hex,代码行数:29,代码来源:Line.cs

示例4: Start

 public void Start()
 {
     _line = GetComponent<LineRenderer>();
     _line.enabled = false;
     _light = GetComponent<Light>();
     _light.enabled = false;
     _renderer = _line.GetComponent<Renderer>();
 }
开发者ID:jhessin,项目名称:Widgets,代码行数:8,代码来源:LaserScript.cs

示例5: Start

 void Start()
 {
     line = GetComponent<LineRenderer>();
     line.SetVertexCount(2);
     line.GetComponent<Renderer>().material = lineMaterial;
        // renderer.material = lineMaterial;
     line.SetWidth(0.15f, 0.1f);
     line.enabled = false;
 }
开发者ID:JadeLens,项目名称:TrashPanda,代码行数:9,代码来源:beamWeapon.cs

示例6: Start

    void Start()
    {
        line = GetComponent<LineRenderer>();
        bendPoint = new Vector3[bend];
        line.SetColors(color, color);
        line.SetVertexCount(bend + 2);
        line.GetComponent<Renderer>().sortingLayerName = sortingLayer;
        line.sortingOrder = sortingOrder;

        transform.parent = GameObject.Find("Slots").transform;
    }
开发者ID:Bakiet,项目名称:ZombieMatchSurvival,代码行数:11,代码来源:Lightning.cs

示例7: Start

 void Start()
 {
     _t = transform;
     crt = (Creature)_t.parent.parent.gameObject.GetComponent("Creature");
     eye = crt.eye.GetComponent<Eye>();
     lr = (LineRenderer)gameObject.AddComponent<LineRenderer>();
     lr.material.color = Color.green;
     lr.material.shader = Shader.Find("Sprites/Default");
     lr.SetWidth(line_width, line_width);
     lr.SetVertexCount(2);
     lr.GetComponent<Renderer>().enabled = true;
 }
开发者ID:clomax,项目名称:evosim,代码行数:12,代码来源:Mouth.cs

示例8: LineChart

	public LineChart(GameObject cam, Vector3 pos,Color c,  int count) {
		
		position = pos;
		obj = new GameObject();
		obj.name = "Chart Object";
		obj.transform.parent = cam.transform;
		obj.transform.localPosition = new Vector3(0,0,0);
		obj.transform.localRotation = Quaternion.identity;
		
		line = obj.AddComponent<LineRenderer>();
		size = count;
		horzScale = 1.0f / count;
		line.useWorldSpace = false;
		line.GetComponent<Renderer>().material.shader = Shader.Find("Diffuse");
		line.GetComponent<Renderer>().material.color = c;
		line.SetWidth(0.005f,0.005f);
		line.SetVertexCount(size);
		for(int i = 0; i < size; i++)
			AddData(0.0f);
		
	}
开发者ID:Jicheng-Yan,项目名称:tango-examples-unity,代码行数:21,代码来源:LineChart.cs

示例9: Start

	// Use this for initialization
	void Start () {
		mLine =gameObject.GetComponent<LineRenderer>(); 
		mLine.SetWidth(0.2f, 0.2f); 
		mLine.SetVertexCount(2); 
		mLine.SetColors (Color.yellow,Color.yellow);
		//aMaterial.color = Color.red;
		// mLine.material = aMaterial;
		mLine.material.color = Color.black;  
		mLine.GetComponent<Renderer>().enabled = true; 
		//mLine.SetPosition(0,new Vector3(0,0,0));
		//mLine.SetPosition(1,new Vector3(0,0,0));
		gameObject.GetComponent<LineRenderer>().enabled=false;
	}
开发者ID:wlmgit,项目名称:NailPlate,代码行数:14,代码来源:DrawNailLine.cs

示例10: Start

    void Start()
    {
        line = GetComponent<LineRenderer>();
        line.SetVertexCount(2);
        line.GetComponent<Renderer>().material = lineMaterial;
        line.SetWidth(2.8f, 2.85f);

        GameObject gameControllerObject = GameObject.FindWithTag ("GameController");
        if (gameControllerObject != null) {
            gameController = gameControllerObject.GetComponent <GameController> ();
        } else {
            Debug.Log ("Cannot find 'GameController' script!");
        }
        InvokeRepeating ("Fire", startDelay, fireRate);
    }
开发者ID:TheMSB,项目名称:SpaceShooter,代码行数:15,代码来源:RayGun.cs

示例11: Awake

    void Awake()
    {
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
        laserShotLine = GetComponentInChildren<LineRenderer>();
        laserShotLight = laserShotLine.GetComponent<Light>();
        col = GetComponent<SphereCollider>();
        playerPosition = GameObject.FindGameObjectWithTag(Tags.player).transform;
        playerHealth = playerPosition.gameObject.GetComponent<PlayerHealth>();

        laserShotLine.enabled = false;
        laserShotLight.intensity = 0f;

        shooting = false;
        scaledDamage = maxDamage - minDamage;
    }
开发者ID:djayard,项目名称:DJA-UnityStealth,代码行数:16,代码来源:EnemyShooting.cs

示例12: Start

#pragma warning restore 0414

	void Start () {
		settings = Settings.getInstance();
		
		_t = transform;
		gameObject.tag = "Genital";
		crt = (Creature)_t.parent.parent.gameObject.GetComponent("Creature");
		lg = Logger.getInstance();
		co = CollisionMediator.getInstance();
		eye = crt.eye.gameObject.GetComponent<Eye>();
		
		_t = transform;
		lr = (LineRenderer)gameObject.AddComponent<LineRenderer>();
		lr.material.color = Color.white;
		lr.material.shader = Shader.Find("Sprites/Default");
		lr.SetWidth(line_width, line_width);
		lr.SetVertexCount(2);
		lr.GetComponent<Renderer>().enabled = true;
		timeCreated = Time.time;
		
		line_length = 	float.Parse( settings.contents["genitalia"]["line_length"].ToString() );
	}
开发者ID:clomax,项目名称:evosim,代码行数:23,代码来源:Genitalia.cs

示例13: OnTriggerEnter2D

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Tractor") {
            GameObject player = GameObject.FindGameObjectWithTag("Ship");

            GetComponent<Rigidbody2D>().isKinematic = false;
            //print("collision detected with: " + other.ToString());
            SpringJoint2D spring = gameObject.AddComponent<SpringJoint2D>();
            spring.connectedBody = player.gameObject.GetComponent<Rigidbody2D>();
            spring.distance = 5f;
            spring.dampingRatio = 5f;
            //hinge.anchor = new Vector2(2f, 2f);
            lineDestination = player.gameObject.GetComponent<Rigidbody2D>();
            this.lineRenderer = gameObject.AddComponent<LineRenderer>();
            //lineRenderer.SetWidth(0.1, 0.1);
            lineRenderer.SetVertexCount(2);
            lineRenderer.enabled = true;
            lineRenderer.GetComponent<Renderer>().enabled = true;
            dragging = true;
        }
    }
开发者ID:Morgan10E,项目名称:PewPewLightShips,代码行数:21,代码来源:boxTestTrigger.cs

示例14: Start

	void Start ()
	{
		thresDist = 70;

		PO = transform.gameObject.GetComponent<PlanetaryOrbit> ();
		
		lineRendererLength = 250;
		if (gameObject.name == "MoonSystem")
			lineRendererLength = 30;

		line = gameObject.AddComponent <LineRenderer> () as LineRenderer;
		line.material = Resources.Load ("Materials/Line") as Material;
		line.SetWidth (2f * PO.Par [3], 2f * PO.Par [3]);
		line.SetVertexCount (lineRendererLength);
		
		if (gameObject.tag == "Moon")
			line.material.mainTextureScale = new Vector2 (25, 1);

		for (int i = 0; i < lineRendererLength; i++)
			line.SetPosition (i, transform.position + PO.ParametricOrbit (2 * Mathf.PI / (lineRendererLength - 1) * i));

		line.GetComponent<Renderer> ().enabled = true;
	}
开发者ID:hybrid1969,项目名称:SolarSystemSimulatorGame,代码行数:23,代码来源:OrbitRenderer.cs

示例15: Start

    // Use this for initialization
    void Start()
    {
        _characterHingeJoint = gameObject.GetComponent<HingeJoint>();
        _line = new GameObject("Line").AddComponent<LineRenderer>();

        _line.SetVertexCount(2);
        _line.SetWidth(0.25f, 0.3f);

        _line.gameObject.SetActive(true);
        _line.SetColors(Color.magenta, Color.red);
        _line.GetComponent<Renderer>().material.color = Color.yellow;
    }
开发者ID:wallden,项目名称:Fantastic,代码行数:13,代码来源:Grapple.cs


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