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


C# UnityEngine.LineRenderer类代码示例

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


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


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