本文整理汇总了C#中GameObject.SetWidth方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.SetWidth方法的具体用法?C# GameObject.SetWidth怎么用?C# GameObject.SetWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject.SetWidth方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: MakeLine
private void MakeLine(Networkable a, Networkable b)
{
var dir = -Camera.main.transform.forward;
var line = new GameObject("Line").AddComponent<LineRenderer>();
line.transform.parent = transform;
line.SetWidth(0.4f, 0.4f);
line.SetPosition(0, a.transform.position + dir * 7);
line.SetPosition(1, b.transform.position + dir * 7);
line.sharedMaterial = NodeMaterial;
}
示例3: 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"));
}
示例4: DrawOnMove
void DrawOnMove()
{
//Se os valores X ou Y da variavel MouseLastPosition(Posiçao antiga do mouse) forem diferentes dos valores X ou Y da variavel MouseActualPosition(Posiçao atual do mouse), entao o mouse se moveu
if(MouseLastPosition.x != MouseActualPosition.x || MouseLastPosition.y != MouseActualPosition.y)
{
LineRenderer Line = new GameObject("Line").AddComponent<LineRenderer>();
Line.transform.parent = GameObject.Find("LineMother").transform;
Line.material = LineColor;
Line.SetVertexCount(2);
Line.SetWidth(0.1f,0.1f);
Line.SetPosition(0,Camera.main.ScreenToWorldPoint(new Vector3(MouseLastPosition.x, MouseLastPosition.y, ZPosition)));
Line.SetPosition(1,Camera.main.ScreenToWorldPoint(new Vector3(MouseActualPosition.x, MouseActualPosition.y, ZPosition)));
//Igualando a posiçao antiga do mouse com a atual, para caso ele se mova de novo, a comparaçao seja correta
MouseLastPosition = Input.mousePosition;
}
}
示例5: buildLine
public static void buildLine(Vector3 start, Vector3 end){
LineRenderer line = new GameObject ("Line").AddComponent<LineRenderer> ();
//apparently I should use this as a default material, but it didn't work so I used some arbitrary material
//line.material = new Material(Shader.Find("Particles/Additive"));
line.material = material;
line.gameObject.layer = LayerMask.NameToLayer ("Minimap");
line.material.SetColor ("colour", Color.black);
line.castShadows = false;
line.receiveShadows = false;
line.transform.parent = GameObject.Find("lines").transform;
line.SetWidth(1.0f, 1.0f);
line.SetVertexCount(2);
line.SetPosition(0, start);
line.SetPosition (1, end);
string positions = start.x.ToString () + "," + start.y.ToString () + "," + start.z.ToString () + "," + end.x.ToString () + "," + end.y.ToString () + "," + end.z.ToString ();
if (Network.isServer) {
ClientNetwork client = (ClientNetwork) GameObject.FindObjectOfType(typeof(ClientNetwork));
client.startClientLines (positions);
}
}
示例6: 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>();
}
示例7: 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;
}
示例8: 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);
}
示例9: 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);
}
示例10: 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"));
}