本文整理汇总了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;
}
示例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);
}
示例3: Start
// Use this for initialization
void Start()
{
lineRend = GetComponent<LineRenderer>();
endPositionExtended = endPos.localPosition;
var audios = GetComponents<AudioSource>();
audio = audios [0];
}
示例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;
}
示例5: Start
void Start()
{
if ( !tr ) tr = transform;
lRenderer = tr.GetComponent<LineRenderer>();
ChoseNewAnimationTargetCoroutine();
}
示例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);
}
示例7: Start
// Use this for initialization
void Start()
{
ln = GetComponent<LineRenderer> ();
aud = GetComponent<AudioSource> ();
wave = new float[samples];
ln.SetVertexCount (wave.Length);
}
示例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);
}
示例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;
}
示例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;
}
示例11: Start
// Use this for initialization
void Start()
{
line = GetComponent<LineRenderer>();
SpriteRenderer spriteRenderer = GetComponent<SpriteRenderer>();
line.sortingLayerID = spriteRenderer.sortingLayerID;
line.sortingOrder = spriteRenderer.sortingOrder;
}
示例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;
}
示例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
}
示例14: Start
void Start()
{
line = GetComponent<LineRenderer>();
line.SetVertexCount(2);
line.GetComponent<LineRenderer>().material = lineMaterial;
line.SetWidth(0.1f, 0.1f);
}
示例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);
}