Skip to main content

ScaledLerpFollow

A class in Root.Township, the global namespace.

Footstep effect that trails a player's feet and plays step sounds and size-scaled particles as they move on the ground. Client only by default (from LerpFollowBase).

Constructors​

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

Fields​

16 private and internal fields
MemberWhat it is
private static HashSet<ScaledLerpFollow> activeLerpsEvery live follower, so SetVolume can reach them.
private float currentTimeDelayTime left before another step can play.
private bool hasEffectWhether a particle is set.
private bool hasSoundWhether a step sound is set.
private float intervalBetweenParticlesSquaredSquared distance between steps, scaled by the ground's speed modifier.
private float localSoundVolumeStep volume for your own player. Worked out but not passed to the sound in this build.
private float maximumDistanceSquaredSquared per-frame distance that maps to the top of sizeCurve.
private float minimumDistanceSquaredSquared per-frame distance below which no step plays.
private float minTimeDelayShortest time between two steps.
private PooledObjectDefinition particleSystemPooled particle spawned at each step.
private float remoteSoundVolumeStep volume for other players. Like the local one, not actually applied.
private Vector3 rotationOffsetExtra rotation applied to each spawned particle.
private AnimationCurve sizeCurveCurve from movement speed to particle scale.
private SoundEffectSet soundEffectStep sound, unless the ground overrides it with its own.
private PlayerController targetBacking field for Target.
private float travaledDistanceSquared distance left before the next step.

Properties​

MemberWhat it is
EffectPlayStatus PlayStatus { get; set; }Flags that can turn off the sound or the particle part of the effect.
override PlayerController Target { get; }The player being followed.
protected override Vector3 TargetPosition { get; }The followed player's feet position.

Methods​

MemberWhat it is
override void SetTarget(PlayerController target)Sets the player to follow.
static void SetVolume(float local, float remote)Sets local and remote step volume on every active follower. The setvolume console command calls it.
override void Start()Checks which effects are set, joins the active list and reads the self step volume setting.
protected override void Moving(Vector3 from, Vector3 to)Each frame while grounded: after enough distance and time, plays a step sound and spawns a particle scaled by speed.
2 private and internal methods
MemberWhat it is
private void OnDestroy()Leaves the active list and stops listening for settings.
private void UpdateVolumeBasedOnSettings(Settings obj)Reads the self step volume from game settings.

Used in​

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