本文整理汇总了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>();
}
示例2: Start
void Start()
{
line = GetComponent<LineRenderer>();
line.SetVertexCount(2);
line.GetComponent<LineRenderer>().material = lineMaterial;
line.SetWidth(0.1f, 0.1f);
}
示例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);
}
示例4: Start
public void Start()
{
_line = GetComponent<LineRenderer>();
_line.enabled = false;
_light = GetComponent<Light>();
_light.enabled = false;
_renderer = _line.GetComponent<Renderer>();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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() );
}
示例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;
}
}
示例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;
}
示例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;
}