PlayerSpecialEffectsController
A class in Root.Township, the global namespace.
Visual effects on a player character: teleport and streaming trails, combat wave, shell effects for combat, stat effects and spirit mode, the death animation and level up effects. A component on the player character; most of it does nothing on headless servers.
- Listed in Global namespace: P
- Inherits or implements
MonoBehaviour,IBuildRendererBakeable,IBuildBakeable,ICharacterDummySpecialEffects
Constructors
| Member | What it is |
|---|---|
PlayerSpecialEffectsController() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
43 private and internal fields
| Member | What it is |
|---|---|
private static readonly int _Color | Shader property ID for _Color. |
private static readonly int _MainTex | Shader property ID for _MainTex. |
private static readonly int _Progress | Shader property ID for _Progress, used by the wave, shell and ashes materials. |
private TeleporterTrailLerper activeStreamingTrail | The pooled trail shown while the player is streaming, or null. |
private TeleporterTrailLerper activeTeleportTrail | The pooled trail currently left by a teleport, or null. |
private float baseDissolveStrength | Unused field. |
private Texture2D baseRamp1 | Unused field. |
private Texture2D baseRamp2 | Unused field. |
private Material combatShellMaterialSample | Material the combat shell animator copies for its shell. |
private CharacterComponentController[] controllersToDisableOnDeath | Character controllers that SetActiveStateForOnDeathControllers turns on or off. |
private AtmosphereSet deadAtmosphereSet | Atmosphere set loaded by IncreaseFog for the local player when dying. |
private DeathAnimationSettings deathAnimationSettings | Ashes material, burst shell settings and pre-death and death visuals used by the death animation. |
private Animation deathAnimator | Legacy Animation played at the start of the death animation; it animates the public progress fields. |
private DockVisual[] destroyOnDeath | Dock visuals cleared when the death animation starts. |
private static readonly int Die | Animator hash for a Die parameter. Not used in this class. |
private TransformEvent EffectOnLevelUp | Serialized event meant for level-up. Not used in this class. |
private DurationCurve enterSpiritModeCurve | Curve used by PlayEnterSpiritModeEffect. |
private DurationCurve exitSpiritModeCurve | Curve used by PlayExitSpiritModeEffect. |
private bool hasRolledInFog | Set once the death animation has called IncreaseFog, so it only happens once. |
private bool hasUsedPreVisual | Set once the pre-death visual has spawned during the death animation. |
private bool hasUsedVisual | Set once the death visual has spawned during the death animation. |
private bool isInitialized | Set by CheckInitialize so the shell animators are only initialized once. |
private PooledObjectDefinition levelUpPooledEffect | Pooled effect meant for level-up. Not used in this class. |
private static Logger logger | NLog logger for this class. |
private Dictionary<Renderer, Material> materialMap | Remembers each main renderer's original material when the death animation swaps it for ashes. |
private float minimumDistanceForTrail | Shortest move, in metres, for which EditorTrail spawns a teleport trail. |
private Transform particlesOrigin | Transform the pre-death and death visuals spawn at and attach to. |
private PlayerCharacter playerCharacter | The player character this controller belongs to. |
private IPostProcessController postProcessController | Injected post-processing controller the death animation drives for the local player. |
private PooledObjectDefinition randomParticles | Pooled particles spawned by PlayRandomCustomizationPartsParticles. |
private Material shellMaterial | Unused field; the death animation uses a local copy from the combat shell animator. |
private Coroutine spiritModeAnimationCoroutine | Spirit-mode coroutine to stop before playing a new one. Never assigned in this class. |
private Material spiritModeShellMaterialSample | Material the spirit-mode shell animator copies for its shell. |
private float statBarPingDuration | How long, in seconds, PingStatBars shows the stat bars. |
private StatBarVisibilityGroup[] statBars | Stat bar groups shown by PingStatBars. |
private Material statEffectShellMaterialSample | Material the stat-effect shell animator copies for its shell. |
private PooledObjectDefinition streamingLocomotionTrail | Pooled trail definition used while the player is streaming. |
private EffectPlayStatus streamingTrailPlayStatus | Play status given to new streaming trails; visuals are disabled for the local player. |
private PooledObjectDefinition teleporterTrail | Pooled trail definition left behind when a player teleports. |
private Dictionary<Material, Material> uniqueMaterials | Unused field; the death animation keeps its own local map of original to ashes materials. |
private DurationCurve waveCurve | Curve and duration for the combat wave animation. |
private Material waveMaterial | Per-instance copy of the wave renderer's material, made on the first wave. |
private MeshRenderer waveRenderer | Mesh renderer for the combat wave effect; hidden except while AnimateWave runs. |
Properties
| Member | What it is |
|---|---|
CombatShellAnimator CombatShellAnimator { get; private set; } | Shell effect used in combat; also the shell used by the death animation. |
SpiritModeShellAnimator SpiritModeShellAnimator { get; private set; } | Shell effect for spirit mode. |
StatEffectShellAnimator StatEffectShellAnimator { get; private set; } | Shell effect for stat effects. |
1 private and internal property
Methods
| Member | What it is |
|---|---|
void AnimateWave() | Plays the combat wave effect around the player. |
void CheckInitialize(SkinnedMeshRenderer[] opaqueClothes, SkinnedMeshRenderer[] headOpaqueClothes) | Sets up the three shell animators with the character's clothes once. |
void EditorTrail(float distance) | Starts or refreshes a teleport trail if the move was longer than the minimum trail distance. |
void IncreaseFog() | For the local player, applies the dead atmosphere set. |
void PingStatBars() | Briefly shows the player's stat bars. |
void PlayEnterSpiritModeEffect() | Plays the shell effect for entering spirit mode. |
void PlayExitSpiritModeEffect() | Plays the shell effect for leaving spirit mode. |
void PlayRandomCustomizationPartsParticles(Transform target) | Spawns the customization particles at a transform. |
void RemoteTrail(Vector3 from, bool isUsingTrail) | Starts, refreshes or ends the teleport trail from a position. |
void SetActiveStateForOnDeathControllers(bool isActive) | Turns on or off the character controllers listed to stop on death. |
static void SetMaterial(Material original, Material newMaterial) | Copies colour and main texture from one material to another, using a plain colour texture if there is none. |
AltaCoroutine StartDeathAnimation() | Starts the death animation: body turns to ash, shell bursts and, for the local player, colour grading changes. |
void StreamingTrail(bool isEnabled) | Does nothing in this build. |
protected void Inject(IPostProcessController postProcessController) | Receives the post process controller through dependency injection. |
11 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator AnimateWaveCoroutine() (iterator) | Coroutine behind AnimateWave: shows the wave renderer and drives its _Progress along waveCurve, then hides it. |
private void Awake() | Client only: builds the combat, stat-effect and spirit-mode shell animators and hooks trail cleanup to the entity's destruction. |
private void IBuildRendererBakeable.Bake(bool isSaving) | Build step: disables the wave renderer so it starts hidden. |
private void IBuildRendererBakeable.Clean() | Build step counterpart to Bake; does nothing. |
private void CleanTrail(NetworkEntity entity, bool isUnload) | Releases the active teleport trail when the player entity is destroyed by the scene. |
private void DeactivateTrail(PooledObject oldTrail) | Called when a teleport trail goes back to its pool; clears activeTeleportTrail if it was that trail. |
private IEnumerator DeathAnimation() (iterator) | Coroutine behind StartDeathAnimation: swaps body materials for ashes, plays the death visuals and fog, and drives the shell and post-processing from the animated progress fields. |
private void OnDestroy() | Client only: tears down the three shell animators. |
private void RespositionTrail(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function) | Handles locomotion position changes: moves the streaming trail, and on teleport locomotion also spawns a teleport trail from the old position. |
private void SetStreamingTrail(bool isEnabled) | Spawns or releases the streaming locomotion trail when the player starts or stops streaming. |
private void Start() | Client only: subscribes to the locomotion controller's streaming changes and sets the streaming trail to match. The local player's trail visuals are disabled. |
Used in
Members of other types that take, return or hold a PlayerSpecialEffectsController: