Impactor
A class in Root.Township, Alta.Impact.
The main hitting part of a tool, such as a blade edge or a hammer head. Works out a hit's direction and effectiveness from the tool's recent motion.
- Listed in Items, inventory and logic
- Inherits or implements
ImpactGenerator,IGetRigidbody
Constructors
| Member | What it is |
|---|---|
Impactor() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private ImpactTool impactTool | The impact tool in the parents. |
private bool isUsingImprovedDirection | When on, removes the motion along the edge before scoring direction. |
private static Logger logger | NLog logger; logs errors while working out hits. |
Methods
| Member | What it is |
|---|---|
override AttackParameters GetCurrentAttack() | Current attack damage and point from how far the impactor has moved, or empty if it barely moved. |
override void GetFollowAndCurrent(ContactPointStructure contactPoint, out Vector3 follow, out Vector3 current, out float directionEffMod, out float generalEfficiency, out float directionMultiplier) | For a contact, finds the point now and where it was furthest back, then the efficiency from distance, direction and filters. |
override void Reset() | Resets every effect in EffectsOnReset. |
void UpdateRigidbody() | Registers the parent ImpactTool if no tool is registered yet. |
protected override void OnDestroy() | Calls the base OnDestroy only. |
4 private and internal methods
| Member | What it is |
|---|---|
private float DistanceMultiplier(float distance) | 0 to 1 from how far the impactor moved, between minimum and maximum follow. |
private float NormalMultiplier(Vector3 direction) | How well the swing direction lines up with the impactor's forward, raised to DirectionPower. |
private void OnDrawGizmosSelected() | Draws the forward direction and the edge length in the editor. |
private void Start() | Registers the parent ImpactTool if no tool is registered yet. |