-
Notifications
You must be signed in to change notification settings - Fork 26
Scripts.Health
##Scripts - Health
###What does this do?
This is to keep track if the player is alive or not. If the health <= 0 then the player enters the death state. Will display visuals on damage and trigger animation events on damage. Will also play sounds when gaining and losing health.
###Who/What is this for?
This is designed to work with the GUI health bar to see if the player is still alive or needs to be taken to the death screen.
####Setup
Example Setup:
| Parameter | Type | Description |
|---|---|---|
| Anim | Animator List | A list of animators to update states on. All must contain the same parameter. |
| Health | int | Hit points for your character. |
| Regeneration | int | Hit points per second to regain if not taking damage. |
| Gui On Hit | Texture2D | A GUI visual to display when health is lost. |
| Gui Fade Speed | int | How fast the GUI visual will fade out after appearing. |
| Hit Sounds Volume | float | Override volume level to play sounds at. |
| Player Camera | Camera | The camera to display a visual on. |
| Hit Sounds | AudioClip List | List to randomly select and play a sound from when health is lost. |
| Gain Health Sounds | AudioClip List | List to randomly select and play a sound from when health is gained. |
| Audio Source | AudioSource | Where to play all of these sounds from. |
| Death Cam Parent | Transform | Where to make the camera a child to when health is <= 0. |
| Debug Health | bool | For debugging only. Logs health |
| Debug Dir Hit | bool | For debugging only. Logs the direction from where the player was hit. |
| Stagger On Every Hit | bool | Whether or not to play a damaged animation when health is lost. (Requires All animators to have the same parameter) |
| Death Position | GameObject | Legacy. Where to spawn a ragdolled player. (No Longer in use.) |
The following is a list of github repositories that made all of this possible:
delta patches: https://github.com/OctopusDeploy/Octodiff
.net 4 implemented in Monodevelop: https://github.com/mono/mono
Tuples In Unity: https://gist.github.com/michaelbartnett/5652076
Octodiff: https://github.com/OctopusDeploy/Octodiff
Input Manager: https://github.com/daemon3000/InputManager
