Files
doom-dm/DoomDeathmatch/src/Script/Consumable/HealthPackConsumable.cs
2025-01-07 20:29:20 +03:00

33 lines
988 B
C#

using DoomDeathmatch.Component.MVC;
namespace DoomDeathmatch.Script.Consumable;
/// <summary>
/// Represents a health pack consumable that restores health to the player.
/// </summary>
/// <param name="parHealth">The amount of health restored by the consumable.</param>
public class HealthPackConsumable : IConsumable
{
/// <inheritdoc/>
public string Icon => "texture/health_pack.png";
/// <summary>
/// The amount of health restored by the consumable.
/// </summary>
private readonly float _health;
/// <summary>
/// Initializes a new instance of the <see cref="HealthPackConsumable"/> class with a specified health restoration value.
/// </summary>
/// <param name="parHealth">The amount of health this consumable restores.</param>
public HealthPackConsumable(float parHealth)
{
_health = parHealth;
}
/// <inheritdoc/>
public void Consume(PlayerController parPlayerController)
{
parPlayerController.HealthController.Heal(_health);
}
}