Class PlayerDamageBehaviour
Handle the player damage and death
Inheritance
Object
Component
Behaviour
MonoBehaviour
PlayerDamageBehaviour
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.useGUILayout
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags
Namespace: BomberDogs.PlayerBehaviours
Assembly: Assembly-CSharp.dll
Syntax
[RequireComponent(typeof(PlayerBehaviourCore))]
public class PlayerDamageBehaviour : PlayerBehaviourBase, IDamageTaker, IAddSublife, IUseImmunityVest
Fields
| Edit this page View Source_totalHealth
Declaration
[Header("Debug")]
[SerializeField]
protected int _totalHealth
Field Value
| Type | Description |
|---|---|
| int |
damageBlinkDuration
Declaration
[Tooltip("When the player takes damages or when they start in the level, the enter an immunity state where they blink")]
public float damageBlinkDuration
Field Value
| Type | Description |
|---|---|
| float |
deathAnimationType
Declaration
[Tooltip("There are two possible ways to represent death: With animation or with a sfx object")]
[Header("Death Tweaks")]
public PlayerDamageBehaviour.EDeathAnimationType deathAnimationType
Field Value
| Type | Description |
|---|---|
| PlayerDamageBehaviour.EDeathAnimationType |
dyingCo
Declaration
protected Coroutine dyingCo
Field Value
| Type | Description |
|---|---|
| Coroutine |
dyingSfx
Declaration
public AudioClipSpec dyingSfx
Field Value
| Type | Description |
|---|---|
| AudioClipSpec |
dyingState
Declaration
[Tooltip("Death animator state")]
[ShowIf("deathAnimationType", PlayerDamageBehaviour.EDeathAnimationType.InstantiateDeathSfxPrefab, false)]
[AnimatorStatesDropdown(0)]
public string dyingState
Field Value
| Type | Description |
|---|---|
| string |
genericDeathEffectPrefab
Declaration
[Tooltip("Death sfx prefab")]
[ShowIf("deathAnimationType", PlayerDamageBehaviour.EDeathAnimationType.AnimatorCrossFade, false)]
public GameObject genericDeathEffectPrefab
Field Value
| Type | Description |
|---|---|
| GameObject |
health
Declaration
[Header("General Tweaks")]
public int health
Field Value
| Type | Description |
|---|---|
| int |
immunityDuration
Declaration
[Tooltip("Duration of immunity")]
public float immunityDuration
Field Value
| Type | Description |
|---|---|
| float |
subLifes
Declaration
[Tooltip("When the player takes damage, an sublife is subtracted. Below zero is death.")]
public int subLifes
Field Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceAddSublife(int)
Add Sublife. This is called when the player gets heart powerup
Declaration
public void AddSublife(int number)
Parameters
| Type | Name | Description |
|---|---|---|
| int | number |
Die()
Starts the dying process. Run dying and callback to level manager by calling onDie event.
Declaration
protected virtual void Die()
ImmunityBlink(float?)
Starts to blink with immunity
Declaration
public void ImmunityBlink(float? duration = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float? | duration |
StopImmunity()
Stops the immunity
Declaration
public void StopImmunity()
TakeDamage(DamageEmissionDto)
Takes damage from objects that emit damage.
Declaration
public DamageResponseDto TakeDamage(DamageEmissionDto emission)
Parameters
| Type | Name | Description |
|---|---|---|
| DamageEmissionDto | emission | Damage Emission Information |
Returns
| Type | Description |
|---|---|
| DamageResponseDto | Returns information about the damage, such as who issued it and whether the enemy died |
UseImmunityVest(float?)
Makes the player immortal for a few seconds
Declaration
public void UseImmunityVest(float? duration = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float? | duration |
Events
| Edit this page View SourceonDie
Triggered event when dies.
Declaration
public event Action onDie
Event Type
| Type | Description |
|---|---|
| Action |