Skip to main content

StatUpgradeEffect

A class in Root.Township, the global namespace.

Pooled particle effect for a stat upgrade: particles burst out from a point, then stream along a spline into a target transform, raising an event as each arrives. Client visuals.

Constructors​

MemberWhat it is
StatUpgradeEffect()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

16 private and internal fields
MemberWhat it is
private Color colorBacking field for Color.
private AnimationCurve expansionCurveCurve of burst spread over the expansion time.
private float expansionRadiusHow far particles spread in the burst.
private AnimationCurve offsetCurveHow much of each particle's burst offset remains along the spline.
private PositionEvent onOrbFinishedInspector event raised with the target position each time a particle arrives.
private float originSpeedTangent length at the target end of the spline.
private float particleGapSeconds between releasing each group of particles.
private IUnityUpdateMethod renderUpdateUpdate handle. Not used in this code.
private float speedProgressSpline progress per second for each particle.
private BezierSpline splineBezier spline from the start point to the target.
private int stepIncreaseHow many particles are released per group.
private ParticleSystem systemThe particle system.
private ParticleSystemRenderer systemRendererThe particle renderer, given the trail material once particles start moving.
private Transform targetTransform the particles fly to. The effect stops if it is destroyed.
private float targetSpeedUpward tangent length at the start of the spline.
private Material trailMaterialTrail material used while particles travel.

Properties​

MemberWhat it is
Color Color { get; set; }Particle start colour. Setting it updates the particle system.

Methods​

MemberWhat it is
void Set(Transform target, Vector3 originPosition, float duration, Color color)Sets the colour, target and start point and starts the animation with the given expansion time.
2 private and internal methods
MemberWhat it is
private IEnumerator Animation(float expansionDuration, Vector3 originPosition) (iterator)Coroutine that expands the burst, then sends particles in groups along the spline to the target and releases the effect.
private void UpdateColor()Applies Color as the particle system's start colour.