ImpactGenerator
An abstract class in Root.Township, Alta.Impact.
Base component for the part of an item or creature that deals hits (a blade edge, a point, a creature attack). It holds the damage values and settings that impact detectors read when hit.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour - Derived types
FixedImpactor,Impactor
Constructors
| Member | What it is |
|---|---|
protected ImpactGenerator() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected Transform cachedTransform | Cached transform of this component. |
4 private and internal fields
| Member | What it is |
|---|---|
private ImpactorSettings impactorSettings | Backing field for ImpactorSettings: hardness, immunity groups and damage or block effects. |
private ImpactorValues impactorValues | Backing field for ImpactorValues: impact type, channels, damage modifiers and edge length. |
private uint overrideHardnessLevel | Hardness set through HardnessLevel. When 0, the settings' hardness is used. |
private Pickup pickup | Backing field for Pickup, the pickup this impactor is on (found in parents). |
Properties
| Member | What it is |
|---|---|
List<ImpactChannel> Channels { get; } | Damage channels from the ImpactorValues asset. |
float CrippleDamageModifier { get; } | Cripple damage modifier from the values asset, times Multipliers. |
ImpactDetectorSettings.ImpactSettings EffectOnBlock { get; } | Impact effect settings used when the hit is blocked. |
ImpactDetectorSettings.ImpactSettings EffectOnDamage { get; } | Impact effect settings used when the hit deals damage. |
List<IImpactorResetEffect> EffectsOnReset { get; } | Effects run when the impactor resets. |
uint HardnessLevel { get; set; } | Hardness of this impactor, probably compared against what it hits. A non-zero set value overrides the settings asset. |
bool HasLength { get; } | True if the impactor has an edge length (a blade edge rather than a point). |
bool HasTool { get; private set; } | True while an ImpactTool is registered. |
float HealthDamageModifier { get; } | Health damage modifier from the values asset, times Multipliers. |
IEnumerable<ImpactImmunityGroup> ImmunityGroups { get; } | Immunity groups from the settings asset. |
ImpactorSettings ImpactorSettings { get; } | Settings asset: hardness, immunity groups and hit effects. |
ImpactorValues ImpactorValues { get; } | Values asset: damage modifiers, channels, type and edge length. |
ImpactType ImpactType { get; } | Kind of impact (from the values asset). |
float Multipliers { get; set; } | Extra multiplier on health and cripple damage. Defaults to 1. |
Vector3 Normal { get; } | The transform's forward direction. |
Pickup Pickup { get; } | The pickup this impactor belongs to, found in its parents. |
ImpactTool RegisteredTool { get; private set; } | The tool currently linked to this impactor, or null. |
virtual bool UpdatesPosition { get; } | Whether this impactor moves and needs position tracking. True by default; FixedImpactor returns false. |
protected PositionRecord FromTool { get; private set; } | Position record of this impactor relative to the registered tool's transform. |
Events
| Member | What it is |
|---|---|
event Action<ImpactHitWithTool> OnHittingImpactDetector | Raised when this impactor hits an impact detector. |
Methods
| Member | What it is |
|---|---|
void DeRegisterTool(ImpactTool toolToDeregister) | Unlinks the given tool if it is the registered one and disables the component. |
abstract AttackParameters GetCurrentAttack() | Returns the attack parameters for this impactor right now. AI uses it to read creature attacks. |
abstract void GetFollowAndCurrent(ContactPointStructure contactPoint, out Vector3 follow, out Vector3 current, out float directionEffMod, out float generalEfficiency, out float directionMultiplier) | Works out the previous and current hit positions and the direction and efficiency factors for a contact point. |
void HitImpactDetector(ImpactHitWithTool hit) | Raises OnHittingImpactDetector with the given hit. |
void RegisterTool(ImpactTool toolToRegister) | Links an ImpactTool to this impactor, enables it and resets it when the tool resets. |
abstract void Reset() | Resets the impactor's tracked state. Called when the registered tool resets. |
protected virtual void OnDestroy() | Deregisters the tool if one is still registered. |
Used in
Members of other types that take, return or hold a ImpactGenerator:
ImpactHitWithTool.ImpactHitWithTool, ImpactHitWithTool.Impactor, ImpactorMap.map, ImpactorMap.Map, ImpactorMap.OrderedImpactors, ImpactorMap.MapElement.Add, ImpactorMap.MapElement.impactors, ImpactorMap.MapElement.Impactors, ImpactorMap.MapElement.MapElement, ImpactTool.GetImpactorIndex, ImpactTool.ImpactorsPerCollider, ImpactTool.indexedImpactors, ImpactTool.RegisterImpactorChannels, Wyrm.impactors, PhysicalMaterialPart.impactors, TemperatureCheckInputStructure.ValidateColliderImpactors.