DurabilityStateChangeEffect
A class in Root.Township, the global namespace.
Pooled client effect that copies an item's mesh and plays a shader cut animation on it, with optional particles, when durability state changes. Spawned by DurabilityGlobalSettings.GetEffect.
- Listed in Global namespace: C to D
- Inherits or implements
PooledObject
Constructors
| Member | What it is |
|---|---|
DurabilityStateChangeEffect() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
12 private and internal fields
| Member | What it is |
|---|---|
private static readonly int _Progress | Shader property ID for _Progress. |
private static readonly int _TriCut | Shader property ID for _TriCut. |
private PooledObjectDefinition androidParticleDefinition | Particle definition meant for Android; it took over the old serialized particleDefinition data but is not read by this code. |
private DurationCurve animationProgress | Duration (and curve) of the animation. |
private Coroutine animationRoutine | The running animation coroutine. |
private Material currentMaterial | This effect's own material copy. |
private MeshFilter filterToSet | Mesh filter that receives the copied mesh. |
private PooledObjectDefinition particleDefinition | Pooled particles spawned during the animation. |
private float particleEffectDelay | Progress (0 to 1) at which the particles spawn. |
private PooledParticleSystemMeshEmision particleSystem | The particles spawned for this play. |
private AnimationCurve progressToFullness | Curve from progress to the _TriCut value. |
private MeshRenderer rendererToAnimate | Renderer whose material is animated. |
Properties
1 private and internal property
| Member | What it is |
|---|---|
private PooledObjectDefinition ParticleDefinition { get; } | The particle definition in use; always particleDefinition, never the Android one. |
Methods
| Member | What it is |
|---|---|
override void Release() | Stops the animation early and returns the effect to the pool. |
void SetMesh(Renderer renderer) | Copies the mesh from the given renderer's mesh filter. |
7 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator Animate() (iterator) | Coroutine that drives the shader progress over the curve's duration, spawns particles part way, then releases itself. |
private void Awake() | Makes a tracked copy of the material and hooks the pool's requested and released events. |
private void CleanUp(PooledObject pooledObject) | On release, releases the spawned particle system. |
private void GetParticles() | Spawns the pooled mesh particle system here and gives it the animated mesh. |
private void OnRequested(PooledObject pooledObject) | Starts the animation when the object is taken from the pool. |
private void OnValidate() | Empty. |
private void SetMaterial(float progress) | Sets the shader's _Progress and _TriCut values for a progress. |