Corgi Engine
v9.0
|
Add this component to an object and it will cause damage to objects that collide with it. More...
Public Types | |
enum | KnockbackStyles { KnockbackStyles.NoKnockback, KnockbackStyles.SetForce, KnockbackStyles.AddForce } |
the possible ways to add knockback : noKnockback, which won't do nothing, set force, or add force More... | |
enum | CausedKnockbackDirections { CausedKnockbackDirections.BasedOnOwnerPosition, CausedKnockbackDirections.BasedOnSpeed, CausedKnockbackDirections.BasedOnDamageOnTouchPosition } |
the possible knockback directions when causing damage More... | |
enum | TakenKnockbackDirections { TakenKnockbackDirections.BasedOnDamagerPosition, TakenKnockbackDirections.BasedOnSpeed, TakenKnockbackDirections.BasedOnDamageOnTouchPosition } |
the possible knockback directions when taking damage More... | |
Public Member Functions | |
delegate void | OnHitDelegate () |
a delegate used to communicate hit events More... | |
virtual void | SetCorgiController (CorgiController newController) |
A public method you can use to set the controller from another class More... | |
virtual void | IgnoreGameObject (GameObject newIgnoredGameObject) |
Adds the gameobject set in parameters to the ignore list More... | |
virtual void | StopIgnoringObject (GameObject ignoredGameObject) |
Removes the object set in parameters from the ignore list More... | |
virtual void | ClearIgnoreList () |
Clears the ignore list. More... | |
virtual void | OnTriggerStay2D (Collider2D collider) |
When a collision with the player is triggered, we give damage to the player and knock it back More... | |
virtual void | OnTriggerEnter2D (Collider2D collider) |
Public Attributes | |
LayerMask | TargetLayerMask |
the layers that will be damaged by this object More... | |
bool | ApplyDamageOnTriggerEnter = true |
if this is true, the damage will apply on trigger enter More... | |
bool | ApplyDamageOnTriggerStay = true |
if this is true, the damage will apply on trigger stay More... | |
float | MinDamageCaused = 10f |
The minimum amount of health to remove from the player's health. More... | |
float | MaxDamageCaused = 10f |
The maximum amount of health to remove from the player's health. More... | |
List< TypedDamage > | TypedDamages |
a list of typed damage definitions that will be applied on top of the base damage More... | |
KnockbackStyles | DamageCausedKnockbackType = KnockbackStyles.SetForce |
the type of knockback to apply when causing damage More... | |
CausedKnockbackDirections | DamageCausedKnockbackDirection = CausedKnockbackDirections.BasedOnOwnerPosition |
The direction to apply the knockback in. More... | |
Vector2 | DamageCausedKnockbackForce = new Vector2(10,2) |
The force to apply to the object that gets damaged. More... | |
float | InvincibilityDuration = 0.5f |
The duration of the invincibility frames after the hit (in seconds) More... | |
bool | RepeatDamageOverTime = false |
Whether or not this damage on touch zone should apply damage over time. More... | |
int | AmountOfRepeats = 3 |
if in damage over time mode, how many times should damage be repeated? More... | |
float | DurationBetweenRepeats = 1f |
if in damage over time mode, the duration, in seconds, between two damages More... | |
bool | DamageOverTimeInterruptible = true |
if in damage over time mode, whether or not it can be interrupted (by calling the Health:InterruptDamageOverTime method More... | |
DamageType | RepeatedDamageType |
if in damage over time mode, the type of the repeated damage More... | |
float | DamageTakenEveryTime = 0 |
The amount of damage taken every time, whether what we collide with is damageable or not. More... | |
float | DamageTakenDamageable = 0 |
The amount of damage taken when colliding with a damageable object. More... | |
float | DamageTakenNonDamageable = 0 |
The amount of damage taken when colliding with something that is not damageable. More... | |
KnockbackStyles | DamageTakenKnockbackType = KnockbackStyles.NoKnockback |
the type of knockback to apply when taking damage More... | |
TakenKnockbackDirections | DamageTakenKnockbackDirection = TakenKnockbackDirections.BasedOnDamagerPosition |
The direction to apply the knockback. More... | |
Vector2 | DamageTakenKnockbackForce = Vector2.zero |
The force to apply to the object that gets damaged. More... | |
float | DamageTakenInvincibilityDuration = 0.5f |
The duration of the invincibility frames after the hit (in seconds) More... | |
MMFeedbacks | HitDamageableFeedback |
the feedback to play when applying damage to a damageable More... | |
MMFeedbacks | HitNonDamageableFeedback |
the feedback to play when applying damage to a non damageable More... | |
float | FreezeFramesOnHitDuration = 0f |
the duration of freeze frames on hit (leave it at 0 to ignore) More... | |
GameObject | Owner |
the owner of the DamageOnTouch zone More... | |
OnHitDelegate | OnHit |
OnHitDelegate | OnHitDamageable |
OnHitDelegate | OnHitNonDamageable |
OnHitDelegate | OnKill |
Protected Member Functions | |
virtual void | Awake () |
Initialization More... | |
virtual void | InitializeFeedbacks () |
virtual void | OnEnable () |
OnEnable we set the start time to the current timestamp More... | |
void | OnDisable () |
On Disable we clear our ignore list More... | |
virtual void | Update () |
During last update, we store the position and velocity of the object More... | |
virtual void | ComputeVelocity () |
Computes the velocity based on the object's last position More... | |
virtual void | Colliding (Collider2D collider) |
virtual void | OnCollideWithDamageable (Health health) |
Describes what happens when colliding with a damageable object More... | |
virtual void | ApplyDamageCausedKnockback (float damage, List< TypedDamage > typedDamages) |
virtual bool | ShouldApplyKnockback (float damage, List< TypedDamage > typedDamages) |
Determines whether or not knockback should be applied More... | |
virtual void | ApplyDamageTakenKnockback () |
virtual void | OnCollideWithNonDamageable () |
Describes what happens when colliding with a non damageable object More... | |
virtual void | SelfDamage (float damage) |
Applies damage to itself More... | |
virtual void | OnDrawGizmos () |
A method used to draw gizmos More... | |
Protected Attributes | |
Vector2 | _lastPosition |
float | _startTime = 0f |
Collider2D | _collidingCollider |
Health | _colliderHealth |
CorgiController | _corgiController |
CorgiController | _colliderCorgiController |
CharacterJump | _characterJump |
Health | _health |
List< GameObject > | _ignoredGameObjects |
Color | _gizmosColor |
Vector3 | _gizmoSize |
CircleCollider2D | _circleCollider2D |
BoxCollider2D | _boxCollider2D |
bool | _initializedFeedbacks = false |
Add this component to an object and it will cause damage to objects that collide with it.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Initialization
|
virtual |
Clears the ignore list.
|
protectedvirtual |
|
protectedvirtual |
Computes the velocity based on the object's last position
|
virtual |
Adds the gameobject set in parameters to the ignore list
newIgnoredGameObject | New ignored game object. |
|
protectedvirtual |
|
protectedvirtual |
Describes what happens when colliding with a damageable object
health | Health. |
|
protectedvirtual |
Describes what happens when colliding with a non damageable object
|
protected |
On Disable we clear our ignore list
|
protectedvirtual |
A method used to draw gizmos
|
protectedvirtual |
OnEnable we set the start time to the current timestamp
delegate void MoreMountains.CorgiEngine.DamageOnTouch.OnHitDelegate | ( | ) |
a delegate used to communicate hit events
|
virtual |
|
virtual |
When a collision with the player is triggered, we give damage to the player and knock it back
collider | what's colliding with the object. |
|
protectedvirtual |
Applies damage to itself
damage | Damage. |
|
virtual |
A public method you can use to set the controller from another class
newController |
|
protectedvirtual |
Determines whether or not knockback should be applied
|
virtual |
Removes the object set in parameters from the ignore list
ignoredGameObject | Ignored game object. |
|
protectedvirtual |
During last update, we store the position and velocity of the object
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int MoreMountains.CorgiEngine.DamageOnTouch.AmountOfRepeats = 3 |
if in damage over time mode, how many times should damage be repeated?
bool MoreMountains.CorgiEngine.DamageOnTouch.ApplyDamageOnTriggerEnter = true |
if this is true, the damage will apply on trigger enter
bool MoreMountains.CorgiEngine.DamageOnTouch.ApplyDamageOnTriggerStay = true |
if this is true, the damage will apply on trigger stay
CausedKnockbackDirections MoreMountains.CorgiEngine.DamageOnTouch.DamageCausedKnockbackDirection = CausedKnockbackDirections.BasedOnOwnerPosition |
The direction to apply the knockback in.
Vector2 MoreMountains.CorgiEngine.DamageOnTouch.DamageCausedKnockbackForce = new Vector2(10,2) |
The force to apply to the object that gets damaged.
KnockbackStyles MoreMountains.CorgiEngine.DamageOnTouch.DamageCausedKnockbackType = KnockbackStyles.SetForce |
the type of knockback to apply when causing damage
bool MoreMountains.CorgiEngine.DamageOnTouch.DamageOverTimeInterruptible = true |
if in damage over time mode, whether or not it can be interrupted (by calling the Health:InterruptDamageOverTime method
float MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenDamageable = 0 |
The amount of damage taken when colliding with a damageable object.
float MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenEveryTime = 0 |
The amount of damage taken every time, whether what we collide with is damageable or not.
float MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenInvincibilityDuration = 0.5f |
The duration of the invincibility frames after the hit (in seconds)
TakenKnockbackDirections MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenKnockbackDirection = TakenKnockbackDirections.BasedOnDamagerPosition |
The direction to apply the knockback.
Vector2 MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenKnockbackForce = Vector2.zero |
The force to apply to the object that gets damaged.
KnockbackStyles MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenKnockbackType = KnockbackStyles.NoKnockback |
the type of knockback to apply when taking damage
float MoreMountains.CorgiEngine.DamageOnTouch.DamageTakenNonDamageable = 0 |
The amount of damage taken when colliding with something that is not damageable.
float MoreMountains.CorgiEngine.DamageOnTouch.DurationBetweenRepeats = 1f |
if in damage over time mode, the duration, in seconds, between two damages
float MoreMountains.CorgiEngine.DamageOnTouch.FreezeFramesOnHitDuration = 0f |
the duration of freeze frames on hit (leave it at 0 to ignore)
MMFeedbacks MoreMountains.CorgiEngine.DamageOnTouch.HitDamageableFeedback |
the feedback to play when applying damage to a damageable
MMFeedbacks MoreMountains.CorgiEngine.DamageOnTouch.HitNonDamageableFeedback |
the feedback to play when applying damage to a non damageable
float MoreMountains.CorgiEngine.DamageOnTouch.InvincibilityDuration = 0.5f |
The duration of the invincibility frames after the hit (in seconds)
float MoreMountains.CorgiEngine.DamageOnTouch.MaxDamageCaused = 10f |
The maximum amount of health to remove from the player's health.
float MoreMountains.CorgiEngine.DamageOnTouch.MinDamageCaused = 10f |
The minimum amount of health to remove from the player's health.
OnHitDelegate MoreMountains.CorgiEngine.DamageOnTouch.OnHit |
OnHitDelegate MoreMountains.CorgiEngine.DamageOnTouch.OnHitDamageable |
OnHitDelegate MoreMountains.CorgiEngine.DamageOnTouch.OnHitNonDamageable |
OnHitDelegate MoreMountains.CorgiEngine.DamageOnTouch.OnKill |
GameObject MoreMountains.CorgiEngine.DamageOnTouch.Owner |
the owner of the DamageOnTouch zone
bool MoreMountains.CorgiEngine.DamageOnTouch.RepeatDamageOverTime = false |
Whether or not this damage on touch zone should apply damage over time.
DamageType MoreMountains.CorgiEngine.DamageOnTouch.RepeatedDamageType |
if in damage over time mode, the type of the repeated damage
LayerMask MoreMountains.CorgiEngine.DamageOnTouch.TargetLayerMask |
the layers that will be damaged by this object
List<TypedDamage> MoreMountains.CorgiEngine.DamageOnTouch.TypedDamages |
a list of typed damage definitions that will be applied on top of the base damage