/// <summary> /// A protected method to return a new particle pixel with the randomized color attributes. /// </summary> /// <returns>A new particle pixel with the new color values.</returns> protected override BaseParticle CreateParticle() { ParticleCircle p = new ParticleCircle(); p.Color = Color.FromArgb( Random.Next(this.MinR, this.MaxR), Random.Next(this.MinG, this.MaxG), Random.Next(this.MinB, this.MaxB)); p.Radius = (short)Random.Next((int)m_RadiusMin, (int)m_RadiusMax); return(p); }
void CreateCircle(Vector2 pos, float radius, float fadeOutTime, Color color, CircleType type, int sortOrder = 0, float speed = 1f) { int index = particleCount++; SpriteRenderer sr = renderers[index]; sr.transform.position = pos; sr.sortingOrder = 5 + sortOrder; sr.gameObject.SetActive(true); sr.transform.localScale = Vector2.one * radius / radiusScales[(int)type]; particles[index] = new ParticleCircle(radiusTimes[(int)type], thicknessTimes[(int)type], fadeOutTime, speed); block.Clear(); block.SetFloat(radiusID, radiusScales[(int)type]); block.SetFloat(radiusTimerID, 0); block.SetFloat(thicknessID, thicknessValues[(int)type]); block.SetFloat(thicknessTimerID, 0); block.SetFloat(fadeOutTimerID, 0); block.SetColor(colorID, color); sr.SetPropertyBlock(block); }