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


C# LineRenderer.SetWidth方法代码示例

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


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

示例1: Awake

	void Awake ()
	{
		aniMat = characterModel.GetComponent<Animator>();
		CameraBase = GameObject.Find("CameraBase");
		OxGun = GameObject.Find("Gun");
		lineRenderer = gameObject.AddComponent<LineRenderer>();
		lineRenderer.material = lineMat;
		lineRenderer.SetWidth(0.2F, 0.2F);
		//lineMat.renderQueue = 9999999;
		// NEW ABOVE
		floorMask = LayerMask.GetMask ("FloorMask");
		anim = GetComponent <Animator> ();
		playerRigidbody = GetComponent <Rigidbody> ();
		playerRigidbody.mass = 100f;
		mainCamera = GameObject.Find("Camera").GetComponent<Camera>();
		GameObject[] FoundTerrain = GameObject.FindGameObjectsWithTag("Terrain");

		// turn of bounciness?
		foreach(GameObject terrainPiece in FoundTerrain)
		{
			terrainPiece.layer = 8; // 8 is floormask
			terrainPiece.GetComponent<Collider>().material.bounciness = 0f;
		}
		this.GetComponent<Collider>().material.bounciness = 0f;
	}
开发者ID:RobertLP,项目名称:PortfolioCode,代码行数:25,代码来源:cowboyController.cs

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

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

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

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

示例6: Start

 // Use this for initialization
 void Start()
 {
     lineRenderer = GetComponent<LineRenderer>();
     lineRenderer.SetPosition(0, p0.position);
     lineRenderer.SetPosition(1, p1.position);
     lineRenderer.SetWidth(.02f, 0.02f);
 }
开发者ID:osROSE,项目名称:UnityRose,代码行数:8,代码来源:DrawLine.cs

示例7: Awake

 // Use this for initialization
 void Awake()
 {
     visualLine = GetComponent<LineRenderer> ();
     player = GameObject.FindGameObjectWithTag ("Player").transform;
     visualLine.SetColors (Color.red, Color.red);
     visualLine.SetWidth (0.01f, 0.01f);
 }
开发者ID:CodeoGenic,项目名称:Asteroid_Rift,代码行数:8,代码来源:ShootPlayer.cs

示例8: SetupThrustTrails

	// Use this for initialization
	void SetupThrustTrails () {
		lineRenderer = gameObject.AddComponent<LineRenderer>();
		lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
		lineRenderer.SetColors(Color.yellow, Color.yellow);
		lineRenderer.SetWidth(0.2F, 0.2F);
		lineRenderer.useWorldSpace = false;
	}
开发者ID:PtrickH,项目名称:02-Newtons-Laws,代码行数:8,代码来源:PhysicsEngine.cs

示例9: Start

 private void Start()
 {
     m_LayerMask 	= ~m_LayerMask;
     m_BaseTransform = transform.parent;
     m_Line 			= GetComponent<LineRenderer> () as LineRenderer;
     m_Line.SetWidth (Width, Width);
 }
开发者ID:wevet,项目名称:UnityResources,代码行数:7,代码来源:ProjectileSimulate.cs

示例10: RouteGraphicsPopulate

    public void RouteGraphicsPopulate(int patroli)
    {
        //populate stage
        line = new GameObject();
        line.name = "Trail "+(patroli+1);
        linerenderer = line.AddComponent<LineRenderer>();

        for (int ii = 0; ii < patrol[patroli].waypoint.Count; ii++)
        {
        //Waypoint Objects
        Vector3 spawn;
        spawn = new Vector3(patrol[patroli].waypoint[ii].Coord.x, patrol[patroli].waypoint[ii].Coord.y+0.1f, patrol[patroli].waypoint[ii].Coord.z);
        WpObject = (GameObject)Instantiate(WPModel,spawn, Quaternion.identity);
        WpObject.name ="WP "+(patroli+1)+"."+(ii+1);
        WpText = WpObject.GetComponentInChildren<TextMesh>();
        WpText.text = (patroli + 1) + "." + (ii + 1);
        //Trail / LineRenderer
        linerenderer.SetVertexCount(patrol[patroli].waypoint.Count+1);
        linerenderer.SetWidth(0.1f,0.1f);
        //linerenderer.material.color = Color.green;
        line.renderer.enabled = true;
        linerenderer.renderer.material = TrailMaterial;
        linerenderer.SetPosition(ii,patrol[patroli].waypoint[ii].Coord);
        linerenderer.SetPosition(patrol[patroli].waypoint.Count,patrol[patroli].waypoint[0].Coord);

        }
    }
开发者ID:Jwho303,项目名称:Night-Watch,代码行数:27,代码来源:s_RouteControl.cs

示例11: Start

 // Use this for initialization
 void Start()
 {
     trackedObj = GetComponent<SteamVR_TrackedObject>();
     DrawLine = this.gameObject.AddComponent<LineRenderer>();
     //DrawLine.material = 
     DrawLine.SetWidth(0, 3);
 }
开发者ID:turbosheep,项目名称:ThriveVR,代码行数:8,代码来源:CurveCreator.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     line_renderer = (LineRenderer)this.gameObject.GetComponent<LineRenderer>();
     line_renderer.SetWidth(1f, 3f);
     line_renderer.SetColors(Color.red, Color.green);
     line_renderer.SetVertexCount(2);
 }
开发者ID:luhaixing2012,项目名称:UFO,代码行数:8,代码来源:Liner.cs

示例13: Start

    // Use this for initialization
    void Start()
    {
        lrender = GetComponent<LineRenderer>();
        lrender.SetWidth(5, 2);

        child = transform.GetChild(0);
    }
开发者ID:Taigrrzi,项目名称:Unsound,代码行数:8,代码来源:drawArrow.cs

示例14: Awake

    void Awake()
    {
        // Set up line renderer.
        child = new GameObject("Bird Renderer");
        child.transform.SetParent(transform);

        lineRenderer = child.AddComponent<LineRenderer>();
        lineRenderer.sharedMaterial = Resources.Load("Materials/Unlit") as Material;
        lineRenderer.useWorldSpace = false;
        lineRenderer.SetColors(color, color);
        lineRenderer.SetWidth(lineWidth, lineWidth);

        // Set up ship and use line renderer.
        drawPoints = new List<Vector3>();

        foreach (Vector2 point in shipPoints)
        {
            Vector3 pos = new Vector3(point.x, point.y, 0);
            drawPoints.Add(pos);
        }
        SetPoints(drawPoints);

        // Setup the polygon collider.
        //polyCollider = child.AddComponent<PolygonCollider2D>();
        //polyCollider.points = shipPoints;

        // Set up the circle collider.
        //circleCollider = child.AddComponent<CircleCollider2D>();
        //circleCollider.isTrigger = true;
    }
开发者ID:MurrayIRC,项目名称:scarf,代码行数:30,代码来源:DrawObject.cs

示例15: Start

    void Start()
    {
        highlight_box = (GameObject) Instantiate(highlight_prefab, new Vector3(1000f, 1000f, 1000f), Quaternion.identity);
        movement_line = (LineRenderer) ((GameObject) Instantiate(new GameObject("movement_line"), new Vector3(0f, 0f, 0f), Quaternion.identity)).AddComponent<LineRenderer>();
        movement_line.SetColors(Color.cyan, Color.cyan);
        movement_line.SetWidth(.2f, .2f);
        movement_line.SetVertexCount(3);
        highlight_box.GetComponent<Renderer>().enabled = false;
        movement_line.enabled = false;

        for (int y = 0; y < map_size; y++)
        {
            List<Tile> row = new List<Tile>();
            for (int x = 0; x < map_size; x++)
            {
                Tile tile = ((GameObject)Instantiate(tile_prefab, new Vector3(x - Mathf.Floor(map_size / 2), 0f, y - Mathf.Floor(map_size / 2)), Quaternion.identity)).GetComponent<Tile>();
                tile.grid_position = new Vector2(x, y);
                row.Add(tile);
            }
            map.Add(row);
        }

        player = ((GameObject)Instantiate(player_prefab, new Vector3(7f, 1.2f, 7f), Quaternion.identity)).GetComponent<Player>();
        player.gameObject.tag = "Player";
        other_player = ((GameObject)Instantiate(player_prefab, new Vector3(7f, 1.2f, -7f), Quaternion.identity)).GetComponent<Player>();
        other_player.gameObject.AddComponent<QuestGiver>();
        other_player.gameObject.tag = "QuestGiver";
        players.Add(player);
        players.Add(other_player);
        current_player = players[current_player_index];
        destination = player.transform.position;
        current_player.start_turn();
    }
开发者ID:thyagobr,项目名称:unity_studies,代码行数:33,代码来源:Overlord.cs


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