![]() |
Eye of the Nile Docs
Everything you need to know to get started!
|
Put this script on an object to allow it to take knockback.
Documentation updated 10/10/2024
Public Member Functions | |
void | ApplyKnockback (GameObject sender) |
Applies knockback to this object by adding force in the opposite direction of the sender. | |
void | ApplyKnockback (GameObject sender, float strength) |
Applies knockback to this object by adding force in the opposite direction of the sender. This overload allows one to specify the strength of the knockback. | |
Public Attributes | |
UnityEvent | OnBegin |
Event that is triggered when the knockback begins to be applied. Functions can be subscribed to this events in the Unity Editor. | |
UnityEvent | OnDone |
Event that is triggered when the knockback begins to be applied. Functions can be subscribed to this events in the Unity Editor. | |
Protected Attributes | |
float | kbDelay = 0.15f |
How long after the knockback starts the force on the force should stop being applied. | |
float | defaultStrength = 50 |
The strength of the knockback (amount of force applied) if no strength is given. | |
float | kbResistance = 0 |
The amount of strength subtracted from any knockback applied to this object. | |
Private Member Functions | |
IEnumerator | Reset () |
Waits kbDelay seconds, then resets the object's velocity. | |
Private Attributes | |
Rigidbody2D | rb |
Reference to the rigidbody component of the object. | |
void KnockbackFeedback.ApplyKnockback | ( | GameObject | sender | ) |
Applies knockback to this object by adding force in the opposite direction of the sender.
sender | The object causing the knockback to happen. |
void KnockbackFeedback.ApplyKnockback | ( | GameObject | sender, |
float | strength ) |
Applies knockback to this object by adding force in the opposite direction of the sender. This overload allows one to specify the strength of the knockback.
sender | The object causing the knockback to happen. |
strength | The strength of the force applied to the object. |
|
private |
Waits kbDelay seconds, then resets the object's velocity.
|
protected |
The strength of the knockback (amount of force applied) if no strength is given.
|
protected |
How long after the knockback starts the force on the force should stop being applied.
|
protected |
The amount of strength subtracted from any knockback applied to this object.
UnityEvent KnockbackFeedback.OnBegin |
Event that is triggered when the knockback begins to be applied. Functions can be subscribed to this events in the Unity Editor.
UnityEvent KnockbackFeedback.OnDone |
Event that is triggered when the knockback begins to be applied. Functions can be subscribed to this events in the Unity Editor.
|
private |
Reference to the rigidbody component of the object.