using Sandbox;
using Sandbox.UI;
namespace LuckerGame.EntityComponents.Lucker;
///
/// Handles the stats associated with a lucker during a lobby.
///
public partial class LuckerStats : EntityComponent, ISingletonComponent
{
///
/// The lucker's current score.
///
[Net] private long Score { get; set; }
///
/// Adds points to this lucker's score
///
/// points to add (or remove if negative)
public void AddScore( long points )
{
Score += points;
if ( points == 0 )
{
return;
}
var message = $"{Entity.Name} {(points > 0 ? "gained" : "lost")} {points} points!";
ChatBox.AddInformation( To.Everyone, message );
}
///
/// Resets this lucker's score to zero
///
public void ResetScore()
{
Score = 0;
}
///
/// Gets this lucker's current score
///
/// this lucker's current score
public long GetScore()
{
return Score;
}
}