Skip to main content

ShellAnimator

An abstract class in Root.Township, Alta.PlayerEffects.

Client: draws an extra copy of a player's clothes with a shell material and animates its _Progress value, for effects like combat, stat effects and spirit mode.

Constructors​

MemberWhat it is
ShellAnimator(PlayerCharacter character, Material shellMaterialSample)Creates a ShellAnimator from character and shellMaterialSample.

Fields​

MemberWhat it is
protected Coroutine currentAnimationThe running progress coroutine, if any.
5 private and internal fields
MemberWhat it is
private readonly int _ProgressShader property id for _Progress, the value the shell animation drives.
private bool isEnabledWhether the shell renderers are on; new renderers made in Initialize start with this.
private List<Renderer> renderersShell copies of the clothing renderers made in Initialize. Destroyed ones are dropped on the next toggle.
private Material shellMaterialBacking field for ShellMaterial, made on first use from shellMaterialSample.
private Material shellMaterialSampleTemplate material that ShellMaterial copies.

Properties​

MemberWhat it is
PlayerCharacter Character { get; }The player character the shell is on.
ShellSetting CurrentSetting { get; set; }The shell setting currently applied.
Material ShellMaterial { get; }This shell's own copy of the shell material, made on first use with progress 0.
protected abstract string MeshName { get; }Name of the mesh the shell is for, set by subclasses.
protected IEnumerable<Renderer> Renderers { get; }The shell renderers made by Initialize.

Methods​

MemberWhat it is
void Initialize(LODGroup lodGroup, SkinnedMeshRenderer[] opaqueClothes, SkinnedMeshRenderer[] headOpaqueClothes, bool isFirstPerson)Client: copies the clothing renderers with the shell material and adds them to the LOD group. First person copies only one.
void OnDestroy()Cleans up the shell material.
void SetShellRenderersEnabled(bool isActive)Shows or hides every shell renderer.
protected IEnumerator AnimateProgress(float start, float target, DurationCurve baseCurve, Action callback = null) (iterator)Coroutine that animates the shell's progress along a curve, hiding the shell if it ends near 0 or 1, then runs the callback.