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.
- Listed in Items, inventory and logic
- Inherits or implements
ScriptableObject - Derived types
ImpactDetectorSettings.Create - Nested types
Create,ImpactSettings - Documented in Impacts and hit detection
Constructors
| Member | What it is |
|---|---|
ImpactDetectorSettings() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
10 private and internal fields
| Member | What it is |
|---|---|
private bool affectsDurabilityWhenStruck | Backing field for AffectsDurabilityWhenStruck. Defaults to true. |
private ImpactDetectorSettings.ImpactSettings bad | Effect and sound played when the hit is not valid. |
private PooledObjectDefinition baseEffect | Pooled effect spawned at every valid hit, facing out of the surface, before the good or critical effect. |
private ImpactDetectorSettings.ImpactSettings critical | Effect and sound played when a valid hit's effectiveness is above criticalBase. |
private float criticalBase | Effectiveness a valid hit must exceed to use the critical settings instead of good. Defaults to 1. |
private ImpactDetectorSettings.ImpactSettings good | Effect and sound played for a valid hit at or below criticalBase effectiveness. |
private bool isReflected | When true, the hit effect faces along the hit direction reflected off the surface instead of back along it. |
private float maximumScale | Effect scale at full effectiveness. The spawned effect scales between minimumScale and this. |
private float minimumScale | Effect scale at zero effectiveness. |
private bool provideExperienceWhenHit | Backing field for ProvideExperienceWhenHit. Defaults to true. |
Properties
| Member | What 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
| Member | What 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:
ForgedModel<TB, TA>.coldEffect, ForgedModel<TB, TA>.doneEffect, ForgedModel<TB, TA>.hotEffect, BoulderDefinition.impactSettings, BoulderDefinition.ImpactSettings, ImpactDetector.currentSettings, ImpactDetector.Settings, SparkSecondaryDetector.hitSettings, TreeSpecies.doneEffect, TreeSpecies.DoneEffect, TreeSpecies.hitEffect, TreeSpecies.HitEffect.