feat: Event & Teleporter
This commit is contained in:
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
namespace Arena.Combat
|
||||
{
|
||||
/// <summary>
|
||||
/// Hit points of an entity. Serialized inside the component that owns it (Player, Enemy),
|
||||
/// Health points of an entity. Serialized inside the component that owns it (Player, Enemy),
|
||||
/// which calls Initialize in its Awake.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
@@ -12,19 +12,19 @@ namespace Arena.Combat
|
||||
{
|
||||
#region Fields
|
||||
|
||||
[Tooltip("Hit points when full.")]
|
||||
[Tooltip("Health points when full.")]
|
||||
[Min(1)] public int Max = 100;
|
||||
|
||||
[Tooltip("Current hit points, visible for debugging.")]
|
||||
[Tooltip("Current health points, visible for debugging.")]
|
||||
[SerializeField] private int _current;
|
||||
|
||||
/// <summary>
|
||||
/// Raised with the current and max hit points each time they change.
|
||||
/// Raised with the current and max health points each time they change.
|
||||
/// </summary>
|
||||
public event Action<int, int> OnChange;
|
||||
|
||||
/// <summary>
|
||||
/// Raised once, when the hit points reach zero.
|
||||
/// Raised once, when the health points reach zero.
|
||||
/// </summary>
|
||||
public event Action OnDied;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Arena.Combat
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Fills the hit points. Called by the owner in its Awake.
|
||||
/// Fills the health points. Called by the owner in its Awake.
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace Arena.Combat
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes hit points and raises OnDied the first time they reach zero.
|
||||
/// Removes health points and raises OnDied the first time they reach zero.
|
||||
/// </summary>
|
||||
public void TakeDamage(int amount)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ namespace Arena.Combat
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives hit points back without exceeding Max. Has no effect once dead.
|
||||
/// Gives health points back without exceeding Max. Has no effect once dead.
|
||||
/// </summary>
|
||||
public void Heal(int amount)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user