using RhythmBase.Events;
namespace RhythmBase.Components
{
///
/// Represents the moment a beat is hit in the rhythm game.
///
public struct RDHit
{
///
/// Gets the moment of pressing the beat.
///
public RDBeat Beat { get; }
///
/// Gets the length of time the player held the beat.
///
public float Hold { get; }
///
/// Gets the source event for this hit.
///
public BaseBeat Parent { get; }
///
/// Gets a value indicating whether this hit needs to be held down continuously.
///
public readonly bool Holdable
{
get
{
return Hold > 0f;
}
}
///
/// Initializes a new instance of the struct.
///
/// The source event for this hit.
/// The moment of pressing the beat.
/// The length of time the player held the beat.
public RDHit(BaseBeat parent, RDBeat beat, float hold = 0f)
{
this = default;
Parent = parent;
Beat = beat;
Hold = hold;
}
///
/// Returns a string that represents the current object.
///
/// A string that represents the current object.
public override readonly string ToString() => string.Format("{{{0}, {1}}}", Beat, Parent);
}
}