Items/Pickups/ArmourPickup.cs
/// <summary>
/// A pickup that gives the player some armour.
/// </summary>
public sealed class ArmourPickup : BasePickup
{
/// <summary>
/// How much armour to give to the player
/// </summary>
[Property, Group( "Armour" )] float ArmourGive { get; set; } = 0;
public override bool CanPickup( Player player, PlayerInventory inventory )
{
if ( player.Armour >= player.MaxArmour && ArmourGive > 0 )
return false;
return true;
}
protected override bool OnPickup( Player player, PlayerInventory inventory )
{
player.Armour = (player.Armour + ArmourGive).Clamp( 0, player.MaxArmour );
player.PlayerData.AddStat( $"pickup.armor" );
return true;
}
}