void createLine() { Material materialInstance = new Material(material); Color color = ColorController.GetCurrentColor();//new Color(Random.Range(0.1f, 0.9f), Random.Range(0.1f, 0.9f), Random.Range(0.1f, 0.9f)); materialInstance.SetColor("_Color", color); line = new GameObject("Line" + currLines).AddComponent<LineRenderer>(); line.material = materialInstance; line.positionCount = 2; // Can change for curves line.startWidth = startWidth_; line.endWidth = endWidth_; line.useWorldSpace = useWorldSpace_; line.numCapVertices = numCapVertices_; }
virtual public void Fire() { GameObject shotInstance = Instantiate(shotObject, shotSpawnPoint.position, Quaternion.identity); shotInstance.transform.forward = shotSpawnPoint.forward; if (!shotInstance.GetComponent <ToolShot>()) { return; } Material materialInstance = new Material(material); Brush randomBrush = brushes[Random.Range((int)0, (int)brushes.Length)]; color = ColorController.GetCurrentColor();//new Color(Random.Range(0.1f, 0.9f), Random.Range(0.1f, 0.9f), Random.Range(0.1f, 0.9f)); if (forceAlpha) { color.a = forcedAlpha; } materialInstance.SetColor("_Color", color); timeOfLastShot = Time.time; shotInstance.GetComponent <ToolShot>().SetValues(randomBrush, materialInstance); }