Skip to main content

DirectionalMultiplierCollider

A class in Root.Township, Alta.Impact.

Collider modifier asset that scales damage by the angle a hit comes from, relative to a set direction. A hit whose curve value is 0 or less doesn't count as damaging.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private AnimationCurve angleToMultiplierCurve from hit angle in degrees to damage multiplier.
private Vector3 directionLocal direction, rotated by the modifier's transform, that angles are measured from.
private float lastValueMultiplier from the last IsDamaging call, used by the next ModifyHit. Shared by every collider using this asset.

Methods​

MemberWhat it is
override bool IsDamaging(ImpactDetectorColliderModifier modifier, ImpactTool tool, ContactPointStructure point)Works out the angle between the hit and the rotated direction, stores the curve value, and returns true if it's above 0.
override void ModifyHit(ImpactDetectorColliderModifier modifier, ImpactHitWithTool hit, ContactPointStructure point)Multiplies the hit's health and cripple multipliers by the value stored in IsDamaging, then resets it to 1.