Skip to content

Commit c52d82f

Browse files
Merge pull request #23 from Mateo-Jimenez76/Mateo-Jimenez76-docs-update [skip ci]
docs: Added implementation reference for Damage function.
2 parents 6f38ee7 + abde5b7 commit c52d82f

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,35 @@
44
## How To Use
55
### Dealing Damage
66
To deal damage call the `Damage(int amount)` function. When damage is taken all events in the `OnDamage` UnityEvent will be invoked and if health is <= 0 then `OnDeath` will be invoked aswell.
7-
>[!NOTE]
7+
>[!IMPORTANT]
88
>OnDeath is invoked AFTER OnDamage and not instead of.
99
10+
Implimentation in [Health.cs/Damage(int amount)](https://github.com/Mateo-Jimenez76/Unity-Health-Script/blob/a4a69911970ceddeb410e8de71320b76d3fd5b3a/Runtime/Health.cs#L39-L60)
11+
1012
### Healing
11-
To heal call the `Heal(int amount)` function. This function will invoke all events in the `OnHealth UnityEvent`.
13+
To heal call the `Heal(int amount)` function. This function will also invoke all events in the `OnHealth` UnityEvent.
14+
15+
Implimentation in [Health.cs/Heal(int amount)](https://github.com/Mateo-Jimenez76/Unity-Health-Script/blob/a4a69911970ceddeb410e8de71320b76d3fd5b3a/Runtime/Health.cs#L61-L85)
1216
### Subscribing / Unsubscribing From Events
1317
If you would like to subscribe to the events through scripts you can call `SubscribeTo...(UnityAction action)` followed by the name of the corresponding Unity Event. Ex: `SubscribeToOnDeath(UnityAction action)`. To unsubscribe is the same process but instead you call `UnsubscribeFrom...(UnityAction action)` with the UnityAction you wish to remove from the Event.
1418

1519
# Health Displayer
1620

17-
## How To Use
18-
1921
### Prerequisites
2022
A Health script is required to be on the same object as the HealthDisplayer.
2123
If one is not already on it then one will be created for you due to the effect of `[RequireComponent(typeof(Health))]`\
22-
A reference to a Slider is required
24+
2325
### Displaying As A Bar
2426
<img width="499" height="140" alt="image" src="https://github.com/user-attachments/assets/50f02f87-70bc-48e8-8a6f-4ed7ad7a1035" />
2527

28+
### Prerequisites
29+
A reference to a `Slider` is required
30+
2631
### Displaying As A Number
2732
<img width="520" height="151" alt="image" src="https://github.com/user-attachments/assets/28df8acc-e54f-4dd7-aa5c-4596e72a1d04" />
2833

2934
### Prerequisites
30-
A TextMeshProUGUI is required as a refenced to display the text. While displaying as a number there are several formats to chose from which go as follows.
35+
A `TextMeshProUGUI` is required. While displaying as a number there are several formats to chose from which go as follows.
3136

3237
### Number Display Options
3338

@@ -41,4 +46,5 @@ A TextMeshProUGUI is required as a refenced to display the text. While displayin
4146
# Additional Reading
4247
https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/api/TMPro.TextMeshProUGUI.html \
4348
https://docs.unity3d.com/6000.2/Documentation/ScriptReference/UIElements.Slider.html \
44-
https://docs.unity3d.com/6000.2/Documentation/ScriptReference/Events.UnityAction.html
49+
https://docs.unity3d.com/6000.2/Documentation/ScriptReference/Events.UnityAction.html \
50+
https://docs.unity3d.com/6000.2/Documentation/ScriptReference/RequireComponent.html

0 commit comments

Comments
 (0)