Search Results for

    Show / Hide Table of Contents

    Class Damageable

    Inheritance
    object
    Damageable
    Namespace: Player
    Assembly: cs.temp.dll.dll
    Syntax
    public class Damageable : MonoBehaviour

    Fields

    damage

    The current accumulated damage of the player.

    Declaration
    public float damage
    Field Value
    Type Description
    float

    damageSelfDebug

    If true, applies damage to self for debugging purposes.

    Declaration
    public bool damageSelfDebug
    Field Value
    Type Description
    bool

    dying

    Indicates whether the player is currently dying.

    Declaration
    public bool dying
    Field Value
    Type Description
    bool

    force

    The force applied to the player when hit.

    Declaration
    public float force
    Field Value
    Type Description
    float

    lives

    The number of lives the player has.

    Declaration
    public int lives
    Field Value
    Type Description
    int

    maxDamage

    The maximum damage the player can take before dying.

    Declaration
    public float maxDamage
    Field Value
    Type Description
    float

    Methods

    Damage(float)

    Adds a specified amount of damage to the player.

    Declaration
    public void Damage(float damage)
    Parameters
    Type Name Description
    float damage

    The amount of damage to add.

    HandleDeath()

    Handles player state after death and resets dying state after respawn.

    Declaration
    public void HandleDeath()

    ResetDamage()

    Resets the player's damage to zero.

    Declaration
    public void ResetDamage()

    Respawn()

    Respawns the player at the spawn position and resets damage/health bar.

    Declaration
    public void Respawn()

    Events

    OnPlayerPunched

    Event triggered when the player is punched.

    Declaration
    public event Action<GameObject> OnPlayerPunched
    Event Type
    Type Description
    System.Action<T><GameObject>
    In This Article
    Back to top Example Unity documentation footer