This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
project-undercover/Project Undercover/Assets/Scripts/LineDrawer.cs

31 lines
918 B
C#
Raw Normal View History

2017-09-21 06:48:52 -05:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class LineDrawer
{
public static GameObject MakeLine()
{
GameObject myLine = new GameObject();
myLine.name = "line";
myLine.AddComponent<LineRenderer>();
LineRenderer lr = myLine.GetComponent<LineRenderer>();
lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
lr.startColor = Color.red;
lr.endColor = Color.red;
lr.startWidth = 0.005f;
lr.endWidth = 0.005f;
return myLine;
}
public static void DrawLine(GameObject line, Vector3 start, Vector3 end)
{
GameObject myLine = line;
myLine.transform.position = start;
LineRenderer lr = myLine.GetComponent<LineRenderer>();
lr.enabled = true;
lr.SetPosition(0, start);
lr.SetPosition(1, end);
}
}