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


C# GameObject.SetColors方法代码示例

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


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

示例1: getLine

 // Following method creates new line for MagnifyGlass's border
 private LineRenderer getLine()
 {
     LineRenderer line = new GameObject("Line").AddComponent<LineRenderer>();
     line.material = new Material(Shader.Find("Diffuse"));
     line.SetVertexCount(2);
     line.SetWidth(0.2f, 0.2f);
     line.SetColors(Color.black, Color.black);
     line.useWorldSpace = false;
     return line;
 }
开发者ID:FourSwordKirby,项目名称:Sudoku,代码行数:11,代码来源:MagnifyingGlass.cs

示例2: makeGrid

 private void makeGrid(Vector3 begin, Vector3 end)
 {
     LineRenderer line = new GameObject().AddComponent<LineRenderer>();
     line.transform.parent = this.transform.parent;
     line.SetWidth(0.01F, 0.01F);
     line.SetColors(lightBlue, lightBlue);
     line.SetPosition(0, begin);
     line.SetPosition(1, end);
     line.SetVertexCount(2);
     line.material = new Material(Shader.Find("Particles/Additive"));
 }
开发者ID:gabrielamboss,项目名称:Ulkoa,代码行数:11,代码来源:GraphMaker.cs

示例3: MakeMeLaser

	public void MakeMeLaser(Color color)
	{
		/*
		foreach(GameObject go in GameObject.FindObjectsOfType(typeof(GameObject)))
		{
			if(go.name == "lineUP")
			{
				GameObject.Destroy (go);
			}
		}
		// Set LineRenderer InitializationGameObject yourName = new GameObject();
		LineRenderer lineRenderer = new GameObject("lineUP").AddComponent<LineRenderer>();
		lineRenderer.sharedMaterial = new Material(Shader.Find("Particles/Additive"));
		lineRenderer.SetColors(Color.red, Color.red);
		lineRenderer.SetWidth(1f, 1f);
		lineRenderer.SetVertexCount(2);
		
		// We need no Shadows
		lineRenderer.castShadows = false;
		lineRenderer.receiveShadows = false;
		Debug.Log ("Raw posX: " + posX + "Raw posX: " + posY);

		float worldX = posX * 4;
		float worldZ = posY * 4;

		Vector3 pos = new Vector3(worldX + 2, 0, worldZ + 2);
		lineRenderer.SetPosition(0, pos);

		pos = new Vector3(worldX + 2, 800, worldZ + 2);
		lineRenderer.SetPosition(1, pos);
		*/
		// Make 
		//GameController.instance.treeGroupController.AddTreeGroup(posX, posY);

		RaycastHit hit;

		// Set LineRenderer InitializationGameObject yourName = new GameObject();
		LineRenderer lineRenderer = new GameObject("lineUP").AddComponent<LineRenderer>();
		lineRenderer.sharedMaterial = new Material(Shader.Find("Particles/Additive"));
		lineRenderer.SetColors(color, color);
		lineRenderer.SetWidth(0.2f, 0.2f);
		lineRenderer.SetVertexCount(5);
		
		// We need no Shadows
		lineRenderer.castShadows = false;
		lineRenderer.receiveShadows = false;
		
		float worldX = posX * 4;
		float worldZ = posY * 4;
		Vector3 pos;
		Ray ray = new Ray(new Vector3(worldX, 10, worldZ), Vector3.up);
		if (Physics.Raycast (ray, out hit)) 
		{
			pos = new Vector3(worldX, hit.point.y + 1, worldZ);
			lineRenderer.SetPosition(0, pos);
		}


		ray = new Ray(new Vector3(worldX + 4, 10, worldZ), Vector3.up);
		if (Physics.Raycast (ray, out hit)) 
		{
			pos = new Vector3(worldX + 4, hit.point.y + 1, worldZ);
			lineRenderer.SetPosition(1, pos);
		}

		ray = new Ray(new Vector3(worldX + 4, 10, worldZ + 4), Vector3.up);
		if (Physics.Raycast (ray, out hit)) 
		{
			pos = new Vector3(worldX + 4, hit.point.y + 1, worldZ + 4);
			lineRenderer.SetPosition(2, pos);
		}

		ray = new Ray(new Vector3(worldX, 10, worldZ + 4), Vector3.up);
		if (Physics.Raycast (ray, out hit)) 
		{
			pos = new Vector3(worldX, hit.point.y + 1, worldZ + 4);
			lineRenderer.SetPosition(3, pos);
		}

		ray = new Ray(new Vector3(worldX, 10, worldZ), Vector3.up);
		if (Physics.Raycast (ray, out hit)) 
		{
			pos = new Vector3(worldX, hit.point.y + 1, worldZ);
			lineRenderer.SetPosition(4, pos);
		}
	

		lineRenderer.gameObject.AddComponent<SelectionLine>();
	}
开发者ID:JulianVallee,项目名称:RTS,代码行数:89,代码来源:GridField.cs

示例4: createLine

    private LineRenderer createLine()
    {
        LineRenderer line;

        line = new GameObject("Line").AddComponent<LineRenderer>();

        line.SetWidth(0.06f, 0.06f);

        line.material = this.material;

        line.material.SetColor("_Color", new Color(0.8824f, 0.1843f, 0.0413f));

        line.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        line.SetColors(new Color(0.8824f, 0.1843f, 0.0413f), new Color(0.8824f, 0.1843f, 0.0413f));

        line.SetVertexCount(2);

        return line;
    }
开发者ID:wasiher,项目名称:funk,代码行数:19,代码来源:DrawGraph.cs

示例5: drawLine

 protected void drawLine(Vector3 start, Vector3 end, Color color)
 {
     LineRenderer line = new GameObject("Line ").AddComponent<LineRenderer>();
     line.SetWidth(0.025F, 0.025F);
     line.SetColors(color, color);
     line.SetVertexCount(2);
     line.SetPosition(0, start);
     line.SetPosition(1, end);
     line.material.shader = (Shader.Find("Unlit/Color"));
     line.material.color = color;
     lines.Add(line.gameObject);
 }
开发者ID:autarch-design-team,项目名称:OpenCircuit,代码行数:12,代码来源:AbstractVisualSensor.cs

示例6: DrawLine

	// Draw a single line.
	void DrawLine(int lineMultiplicator, Axis axis)
	{
		// Set LineRenderer InitializationGameObject yourName = new GameObject();
		LineRenderer lineRenderer = new GameObject("line").AddComponent<LineRenderer>();
		lineRenderer.sharedMaterial = lineMaterial;
		lineRenderer.SetColors(c1, c2);
		lineRenderer.SetWidth(beginWidth, endWidth);
		lineRenderer.SetVertexCount(lengthOfLineRenderer / lineSegmentLenght + 1);
		
		// We need no Shadows
		lineRenderer.castShadows = false;
		lineRenderer.receiveShadows = false;
		
		// Create LineVertexes
		InstantiateLine(lineMultiplicator, lineRenderer, axis);
		
	}
开发者ID:JulianVallee,项目名称:RTS,代码行数:18,代码来源:TerrainGrid.cs

示例7: makeLineGraph

 private void makeLineGraph(Vector3 begin, Vector3 end)
 {
     //makePoint(begin);
    // makePoint(end);
     LineRenderer line = new GameObject().AddComponent<LineRenderer>();
     line.transform.parent = this.transform.parent;
     line.SetWidth(0.05F, 0.05F);
     line.SetColors(Color.green, Color.green);
     line.SetPosition(0, begin);
     line.SetPosition(1, end);
     line.SetVertexCount(2);
     line.material = new Material(Shader.Find("Particles/Additive"));
 }
开发者ID:gabrielamboss,项目名称:Ulkoa,代码行数:13,代码来源:GraphMaker.cs


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