// Use this for initialization void Start() { trail = gameObject.GetComponent(typeof(AraTrail)) as AraTrail; particle = gameObject.GetComponent(typeof(ParticleSystem)) as ParticleSystem; trail.emit = false; //trail.emitting = false; }
private IEnumerator PaintTrail(GameObject brush, PaintStroke paintstroke, AraTrail araTrail) { Vector3 paintstrokeOffset = new Vector3(0f, 0f, 0.5f); araTrail.hasMoved = true; // on by default, controls whether a point is emitted //brush.transform.parent = paintstrokeParent.transform; for (int i = 0; i < paintstroke.verts.Count; i++) { // can't set point color directly, so set the initialColor, which is then used to create the pointColor for the next point araTrail.initialColor = paintstroke.pointColors[i]; // set the initialThickness, which is then used to create the size of the next point araTrail.initialThickness = paintstroke.pointSizes[i]; brush.transform.position = paintstroke.verts[i] + paintstrokeOffset; yield return(new WaitForSeconds(paintWait)); // allow enough time for the previous mesh section to be generated } araTrail.loading = false; // Now that the PaintStroke has been saved, unparent it from the target so it's positioned in worldspace // TODO: refactor into its own method (repeated (almost) in RemoveBrushFromTarget()) brush.tag = "PaintStroke"; // Remove the reticle and brush, no longer needed foreach (Transform child in brush.transform) { Destroy(child.gameObject); } }
private void UpdateBrushColor() { //Set the color of the brush, so user knows what color they are painting with // the outer, edge color -- adjust it to be darker brushColorMats[0].color = new Color(paintColor.r * colorDarken, paintColor.g * colorDarken, paintColor.b * colorDarken); brushColorMats[1].color = paintColor; // the inner color GameObject currentBrush = GameObject.FindWithTag("PaintBrush"); if (currentBrush) { currentAraTrail = currentBrush.GetComponent <AraTrail>(); currentAraTrail.materials[0].color = paintColor; currentAraTrail.initialColor = paintColor; } }
private void AddPaintStrokeToList(GameObject brush) { // 3rd party Ara Trails replaces Unity Trail Renderer List <Vector3> vertList = new List <Vector3>(); List <Color> colorList = new List <Color>(); List <float> sizeList = new List <float>(); AraTrail araTrail = brush.GetComponent <AraTrail>(); //araTrail.active = false; // not being actively drawn, so do not need to constantly update rounded end points araTrail.trailstate = AraTrail.TrailState.DrawnFlatEnd; // allow rounding points to be added. araTrail.initialColor = paintColor; araTrail.initialThickness = brushSize; int numPosAra = araTrail.points.Count; for (int i = 0; i < numPosAra; i++) { vertList.Add(araTrail.points[i].position); colorList.Add(araTrail.points[i].color); sizeList.Add(araTrail.points[i].thickness); // alternately, could add the AraTrail points themselves to the Paintstroke, // since they already hold the colors, plus other info such as discontinuous. } // Add the rounding endpoints to the list of points //for (int i = 0; i < araTrail.endPoints.Count; i++) //{ // vertList.Add(araTrail.endPoints[i].position); // colorList.Add(Color.yellow); // test to see if endpoints are added //colorList.Add(araTrail.endPoints[i].color); // sizeList.Add(araTrail.endPoints[i].thickness); //} // Only add the new PaintStrokes if it's newly created, not if loading from a saved map // TODO: Need a bool to prevent saving to list when strokes are being recreated? //if (!paintOnComponent.meshLoading) //{ PaintStroke paintStroke = brush.AddComponent <PaintStroke>(); paintStroke.color = paintColor; paintStroke.verts = vertList; paintStroke.pointColors = colorList; paintStroke.pointSizes = sizeList; paintStrokesList.Add(paintStroke); // } }
public void RecreatePaintedStrokes() { paintstrokeParent.transform.position = new Vector3(0f, 0f, 1f); // The paint stroke info that was saved with the map should already have been put into paintStrokesList foreach (PaintStroke paintstroke in paintStrokesList) { // position the new paintbrush at the first point of the vertex list GameObject newBrush = Instantiate(paintBrushPrefab, paintstroke.verts[0], Quaternion.Euler(new Vector3(0f, 90f, 0f))); newBrush.transform.parent = paintstrokeParent.transform; AraTrail araTrail = newBrush.GetComponent <AraTrail>(); araTrail.hasMoved = true; // on by default, controls whether a point is emitted araTrail.loading = true; araTrail.initialColor = paintstroke.color; araTrail.space = Space.Self; // allows the paintstroke to be moved with the parent's movement araTrail.trailstate = AraTrail.TrailState.Redrawing; StartCoroutine(PaintTrail(newBrush, paintstroke, araTrail)); } }
void Start() { trail = GetComponent <AraTrail>(); nonPlayerLayers = ~LayerMask.GetMask("Player"); }
void Awake() { trail = GetComponent <AraTrail>(); }
protected override void OnAttackInitialize() { trail = GetComponent <AraTrail>(); }