Skip to main content

SplineParticlesPooled

A class in Root.Township, the global namespace.

Client: a pooled curved line with particles running along it between two transforms, such as the crafting line between parts.

Constructors​

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

Fields​

MemberWhat it is
protected Transform originThe start transform.
protected Transform targetThe end transform.
5 private and internal fields
MemberWhat it is
private PlayerCharacter characterPlayer character whose IK pre-render callback drives updates, if Set got one.
private Color colorBacking field for Color.
private bool hasParticlesOnAndroidInspector flag. Not read anywhere in this class.
private int intervalsNumber of line points along the spline, from CraftingLineIterations (at least 2).
private static Logger loggerNLog logger for this class.

Properties​

MemberWhat it is
Color Color { get; set; }Colour of the line and its particles.
protected virtual float AlignmentMultiplier { get; }How closely the two ends face the same way, 0 to 1. Bends the curve more when aligned.
protected virtual float DistanceMultiplier { get; }How far apart the ends are, as 0 to 1 over the first half metre.
protected LineRenderer LineRenderer { get; private set; }The line renderer that draws the curve.
protected virtual Vector3 OriginForward { get; }Direction the curve leaves the origin.
protected virtual Vector3 OriginPosition { get; }Where the curve starts.
protected virtual Vector3 TargetForward { get; }Direction the curve arrives at the target.
protected virtual Vector3 TargetPosition { get; }Where the curve ends.
4 private and internal properties
MemberWhat it is
private ParticleSystem.Particle[] Particles { get; set; }Buffer for reading and rewriting the particle system's particles, regrown if maxParticles increases.
private float Speed { get; set; }Control point length for the spline ends, from PickupTypeSettings.CraftingLineVelocity.
private BezierSpline Spline { get; set; }The child Bezier spline that the line and particles follow.
private ParticleSystem System { get; set; }The child particle system whose particles are placed along the spline.

Methods​

MemberWhat it is
void RenderUpdate()Rebuilds the curve, line points and particle positions.
void Set(Transform origin, Transform target, PlayerController player, Color color)Connects the line between two transforms with a colour. For player characters it updates before IK rendering, otherwise every frame.
protected virtual void Awake()Finds the spline, particle system and line renderer, and reads line speed and segment count from pickup type settings.
protected virtual float Multiplier()How far the curve's control points stick out: 30% alignment, 70% distance.
2 private and internal methods
MemberWhat it is
private void ResetUnpooled(PooledObject pooledObject)Runs on release: unhooks RenderUpdate from the character's IK pre-render callback.
private void Update()Calls RenderUpdate each frame when there is no player character to hook into.

Used in​

Members of other types that take, return or hold a SplineParticlesPooled: