Skip to main content

DurabilityGlobalSettings

A class in Root.Township, the global namespace.

Global settings for item durability feedback: break effects, damage popups and how hit effectiveness turns into durability loss.

Constructors​

MemberWhat it is
DurabilityGlobalSettings()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

6 private and internal fields
MemberWhat it is
private AnimationCurve breakItemHapticCurveHaptic curve played when an item breaks.
private SoundEffectSet defaultStateChangeSoundSound played on a durability state change when none is set elsewhere.
private AnimationCurve effectivenessToDurabilityDamageCurve from hit effectiveness to durability damage, used by EvaluateEfectivenessDamage.
private Gradient popupColorByDurabilityGradient that colours the popup by durability, used by GetPopupColor.
private PooledObjectDefinition popUpDefinitionPooled text popup shown for durability, used by GetPopup.
private PooledObjectDefinition stateChangeEffectDefinitionPooled DurabilityStateChangeEffect spawned by GetEffect.

Properties​

MemberWhat it is
AnimationCurve BreakItemHapticCurve { get; }Haptic curve played on the holding hand when an item breaks.
SoundEffectSet DefaultStateChangeSound { get; }Sound played when an item's durability state changes.

Methods​

MemberWhat it is
float EvaluateEfectivenessDamage(float effectiveness)Durability loss for a hit's effectiveness. ImpactTool multiplies it by the hit's durability multiplier.
PooledObject GetEffect(Renderer renderer)Spawns the state change effect shaped to a renderer's mesh.
TextPopup GetPopup(Transform parent)Gets a pooled text popup under a parent.
Color GetPopupColor(float durability)Popup colour for a durability value.