Skip to main content

ImpactDetectorSettings

A class in Root.Township, Alta.Impact.

Asset for how an impact detector reacts to hits: the sounds and effects for critical, good and bad hits, and whether hits wear the tool or give experience.

Constructors​

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

Fields​

10 private and internal fields
MemberWhat it is
private bool affectsDurabilityWhenStruckBacking field for AffectsDurabilityWhenStruck. Defaults to true.
private ImpactDetectorSettings.ImpactSettings badEffect and sound played when the hit is not valid.
private PooledObjectDefinition baseEffectPooled effect spawned at every valid hit, facing out of the surface, before the good or critical effect.
private ImpactDetectorSettings.ImpactSettings criticalEffect and sound played when a valid hit's effectiveness is above criticalBase.
private float criticalBaseEffectiveness a valid hit must exceed to use the critical settings instead of good. Defaults to 1.
private ImpactDetectorSettings.ImpactSettings goodEffect and sound played for a valid hit at or below criticalBase effectiveness.
private bool isReflectedWhen true, the hit effect faces along the hit direction reflected off the surface instead of back along it.
private float maximumScaleEffect scale at full effectiveness. The spawned effect scales between minimumScale and this.
private float minimumScaleEffect scale at zero effectiveness.
private bool provideExperienceWhenHitBacking field for ProvideExperienceWhenHit. Defaults to true.

Properties​

MemberWhat it is
bool AffectsDurabilityWhenStruck { get; }Whether hitting this wears down the tool. True by default.
PooledObject LastEffect { get; private set; }The effect object spawned by the last PlayEffects, or null.
bool ProvideExperienceWhenHit { get; }Whether hitting this can give experience. True by default.

Methods​

MemberWhat it is
void PlayEffects(ImpactHit hit)Plays the critical, good or bad sound and effect for a hit, scaled by how effective it was. Without a scale, skips hits with no effect.
void PlayEffects(ImpactHit hit, float scale)Plays the critical, good or bad sound and effect for a hit, scaled by how effective it was. Without a scale, skips hits with no effect.

Used in​

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