33 lines
977 B
C#
33 lines
977 B
C#
using DoomDeathmatch.Component.MVC;
|
|
using DoomDeathmatch.Script.Model.Weapon;
|
|
|
|
namespace DoomDeathmatch.Script.Consumable;
|
|
|
|
/// <summary>
|
|
/// Represents a weapon consumable that grants weapon or reloads ammo to the player.
|
|
/// </summary>
|
|
public class WeaponConsumable : IConsumable
|
|
{
|
|
/// <inheritdoc/>
|
|
public string Icon => _weaponData.IdleTexture;
|
|
|
|
/// <summary>
|
|
/// The weapon data associated with this consumable.
|
|
/// </summary>
|
|
private readonly WeaponData _weaponData;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="WeaponConsumable"/> class with the specified weapon data.
|
|
/// </summary>
|
|
/// <param name="parWeaponData">The weapon data associated with this consumable.</param>
|
|
public WeaponConsumable(WeaponData parWeaponData)
|
|
{
|
|
_weaponData = parWeaponData;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public void Consume(PlayerController parPlayerController)
|
|
{
|
|
parPlayerController.WeaponController.AddOrMergeWeapon(_weaponData);
|
|
}
|
|
} |