Me::DerangedSenators::CopsAndRobbers::PlayerHealth
This script is responsible for the function of the health bar and damage
Inherits from MonoBehaviour
Public Functions
Name | |
---|---|
void | Start() At the start of the project the player's health will equal to the max health |
void | Update() This function checks if a user Used Space if it does the player will take 1.5 dmg |
void | Damage(float damage) This function will lower the current player health by set amount |
Public Attributes
Name | |
---|---|
float | maxHealth |
float | currentHealth |
HealthBar | healthBar |
Public Functions Documentation
function Start
inline void Start()
At the start of the project the player's health will equal to the max health
function Update
inline void Update()
This function checks if a user Used Space if it does the player will take 1.5 dmg
function Damage
inline void Damage(
float damage
)
This function will lower the current player health by set amount
Parameters:
- damage Amount of damage taken, to update health bar
Public Attributes Documentation
variable maxHealth
float maxHealth = 100f;
variable currentHealth
float currentHealth;
variable healthBar
HealthBar healthBar;
Updated on 22 January 2021 at 09:54:46 UTC